I am trying to use a variabe to camcattenate a string
I use following:
DECLARE @MYVAR Char(1000) = 'INITIAL'
if Conditon 1
SET @MYVAR = @MYVAR + ' ABC'
If Condition 2
SET @MYVAR = @MYVAR + 'DEF'
But Myvar nver changes from the Initial value
DECLARE @MYVAR var
Char(1000) = 'INITIAL'
When you declare variable like char(n) and set it, the first M symbols will be set ('INITIAL'-7 chars in your case), other 1000-7=993 symbols will be ' '.
After that when you selecting variable in SSMS - it won't show you all the 1000 symbols, instead it will show you the several first one, and it will seem like 'INITIAL '.
I am really sorry for my poor gramma. And I hope that value of my answers will outweigh the harm for your eyes.Blog: http://somewheresomehow.ruTwitter: @SomewereSomehow