Using SQL Server 2008
DECLARE @myVariable nvarchar (500)
SET @myVariable = 'select distinct b.*,v.vertrag_id,v.VersicherungsscheinNummer
from CRM_Wifo_GmbH.dbo.vertrag_168 v,temp_universa b
where v.VersicherungsscheinNummer like '%' + b.vsnr + '%
and v.gesellschaft_id in('59','66')'
I have to set the value of this type in a variable. How could I do this? Is it possible? USING ‘ ‘ sign in a string?
You just need to escape the single quote
'using 2 single quotes instead''I am also using
N', so that I can span the string on multiple lines