sql - nvarchar concatenation problem -
I'm trying to do a simple thing after dealing with all the hard things, but it seems that it's me Headache is giving. I want to add text to @rxtxml, which is a innovative variable for creating XML elements, but @traxax is the reverse null. Please help. I am posting my code below.
DECLARE @strXml nvarchar (max) = '' SET @strXml = '& lt; Promonym & gt; ' + (Choose Promonym from #Temp) + '& lt; / PromoName & gt; ' SET @strxml = @strXml + '& lt; Promosysk & gt; + (Select PromoDesc from #Temp) + '& lt; / PromoDesc> SET @strxml = @strxml + '& lt; Promocode & gt; + (Choose Promo Code from #Temp) + '& lt; / PromoCode & gt; ' SET @strxml = @strxml + '& lt; Get Started & gt; ' + (Choose Convert (#temp from nvarchar, BeginDate) + '& lt; / BeginDate> SET @strxml = @strxml + '& lt; Endadette & gt; + (#Topp from RawHtml) + 'convert from Tamp (Narvrat, Endadet) +' & lt; / EndDate & gt; SET @strxml = @strXml + '& lt; RAW HTML & gt;' + + & Lt; / RawHtml & gt; SET @strxml = @strxml + '& lt; focuspromoInd & gt;' + convert (nerve, 0) + '& lt; / FocusPromoInd & gt; SET @strxml = @strxml + & # 39; & lt; Parental code & gt; '+ (Choose Parentpromcode from #Temp) +' & lt; / ParentPromoCode & gt; SET @strxml = @strxml + '& lt; Active Ind & gt;' + (When choosing Case for ActiveInd = 1, then '1' ends with '#') + '& lt; / ActiveInd & gt; SET @strxml = @strxml +' & lt; AreaID & gt; '+ (Convert Select (nvarchar, AreaID) #Temp) + '& lt; / AreaID & gt; SET @strXml =' Promosetta & gt; & lt; Promotion & gt; '+ @ Strakes ++ & lt; / promotion & gt; & lt; ; / PromoData> Select '@ StraxMM as StrictMeML'
And when I run the last query, it will be empty. Even in debug mode, I can add @strxml Can not see the update with the price on every line Please help! Thank you.
A field that you are concatenating is empty.
Any time you add a string and a zero value to the SQL, the result is zero.
You can use the COALESCE command to fix it:
declare @strxml nvarchar (max) = '' set @ stringxml = '& lt; Promonym & gt; ' + (Promotion From # Temple, '') Select '+ & lt; / PromoName & gt; ' - and so on
Comments
Post a Comment