sqlserver 动态 sql语句的执行
摘要:1:普通SQL语句可以用exec执行 Select*fromtableName exec('select*fromtableName') execsp_executesqlN'select*fromtableName'--请注意字符串前一定要加N 2:字段名,表名,数据库名之类作为变量时,必须用动态SQL declare@fnamevarchar(20) set@fname='FiledName'Select@fnamefromtableName--错误,不会提示错误,但结果为固定值FiledName,并非所要。 exec('select
阅读全文
posted @ 2012-11-28 21:36
浙公网安备 33010602011771号