February 13, 2017 at 5:58 pm
Hi, I guess I am missing something but this format message script doesn't work.
SELECT FORMATMESSAGE('CTL|%s|%s|%s|', FORMAT(CURRENT_TIMESTAMP, 'yyyyMMdd'),CAST(SUM(totamount) AS varchar(MAX),'100'))
FROM table.xxxx
If I leave the '100' out it returns null, when i put it back i get syntax error so what is wrong?
Thanks
February 13, 2017 at 9:27 pm
Parenthesis were not properly managed, corrected belowSELECT FORMATMESSAGE('CTL|%s|%s|%s|', FORMAT(CURRENT_TIMESTAMP, 'yyyyMMdd'),CAST(SUM(totamount) AS varchar(MAX)),'100')
FROM table.xxxx
'%s' --> signifies as dynamic message
since there are 3 of it so 3 parameters are required i.e., in above case [date], sum of totamount and value '100'
If you do not want 100 then remove the one of the '%s'
February 14, 2017 at 5:53 pm
I do want the 100, but it doesn't work it gets syntax error?
February 14, 2017 at 11:35 pm
have you tried above solution, it works for me
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply