sql cmd 如下:
EXEC TestDB.dbo.TestSP
'<root>
<Param Name="StartDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="EndDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="BusUnit" Depth="2" Value="45"></Param>
<Param Name="MsnGeo" Depth="3" Value="135"></Param>
<Param Name="UserGeo" Depth="0" Value=""></Param>
</root>' , 'UV'如何将上述执行存储过程的命令行赋值给字符串变量? 如何处理其中的引号?spCmd = ?
EXEC TestDB.dbo.TestSP
'<root>
<Param Name="StartDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="EndDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="BusUnit" Depth="2" Value="45"></Param>
<Param Name="MsnGeo" Depth="3" Value="135"></Param>
<Param Name="UserGeo" Depth="0" Value=""></Param>
</root>' , 'UV'如何将上述执行存储过程的命令行赋值给字符串变量? 如何处理其中的引号?spCmd = ?
N'<root> .....' 这样可以吗?
还是指整个 “EXEC TestDB.dbo.TestSP
'<root> 。”都当做字符串赋值给字符串变量?
如果是指这个,这样:
declare @a nvarchar(max)
set @a=N'EXEC TestDB.dbo.TestSP
''<root>
<Param Name="StartDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="EndDate" Depth="5" Type="date" Value="20101201"></Param>
<Param Name="BusUnit" Depth="2" Value="45"></Param>
<Param Name="MsnGeo" Depth="3" Value="135"></Param>
<Param Name="UserGeo" Depth="0" Value=""></Param>
</root>'' , ''UV''
'
print @a