sql server - CHECKSUM_AGG(checksum()) returns stars (**********) -


i calling

id int , tableid int, seid int, ptid int, visid nvarchar(50), tname sysname , columnvalue nvarchar(50), columnkey nvarchar(50), @hashvalue nvarchar(50) output  select @hashvalue = checksum_agg(checksum(id,tableid, seid, ptid, visid, tname, columnkey, columnvalue))  #fdata  

when #fdata contains:

17 3028 100 100003 scrn form.lg_ae 320 invinit

17 3028 100 100003 scrn form.lg_ae 321 authin

......... (6 rows in total similar data, no null values)

it returns **********

but when #fdata contains:

17 3019 101 101001 scrn form.lg_ae 320 invinit

17 3019 101 101001 scrn form.lg_ae 321 authin

...... (65 rows in total similar data, no null values)

it returns integer expected

according this , comments, function str returns * because number, stored in @hashvalue variable, exceeds specified length (default 10). instead of str use cast, example:

print cast(@hashvalue varchar(20)) 

or print value without casting it:

print @hashvalue 

or use function str, length parameter:

print str(@hashvalue,20) 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -