当前位置: 代码迷 >> Sql Server >> 问个sp_exectesql的小疑点
  详细解决方案

问个sp_exectesql的小疑点

热度:113   发布时间:2016-04-27 19:26:58.0
问个sp_exectesql的小问题
我看见书上和网上诸如:
declare @t int exec sp_executesql N'select @x=count(*) from a' ,[email protected] int output',@[email protected] outputprint @t

请问一下那个大写的"N"代表什么啊?

------解决方案--------------------
N --Unicode字符

Unicode每个字符占用2个字节


------解决方案--------------------
@ParmDefinition 参数定义的就是一普通字符串,

你可以直接写
EXECUTE sp_executesql @SQLString, @level tinyint , 
@level = @IntVariable 

这样没任何问题,写这个参数的目的是让你看的更清楚一点,告诉你这个位置是定义参数的,当然也可以定义多个参数

  相关解决方案