摘要: 1 :普通SQL语句可以用Exec执行 eg: Select * from tableName Exec('select * from tableName') Exec sp_executesql N'select * from tableName' -- 请注意字符串前一定要加N 2:字段名,表名,数据库名之类作为变量时,必须用动态SQL eg: declare @fname varchar(20) set @fname = 'FiledName' Select @fname from tableName -- 错误,不会提示错误,但结果为固定 阅读全文
posted @ 2012-08-06 11:12 上海-天浩 阅读(137) 评论(0) 推荐(0) 编辑

Living in ShangHai

Copyright © 2008 天浩阁 Corporation, All Rights Reserved