摘要: 最近用到,在网上查了下资料注意加粗部分,sp_executesql 的参数必须为UNICODE,即NCHAR,NVARCHAR,NTEXT型,否则报错动态sql语句基本语法 1 :普通SQL语句可以用Exec执行Select * from tableName Exec('select * from tableName') Exec sp_executesql N'select * from tableName' -- 请注意字符串前一定要加N 2:字段名,表名,数据库名之类作为变量时,必须用动态SQL eg: declare @fname varchar(20) 阅读全文
posted @ 2012-10-25 11:41 赤狐(zcm123) 阅读(213) 评论(0) 推荐(0) 编辑