• 全部
  • 基础类
  • 应用实例
  • 新技术前沿

在线等,exec执行说不是有效标识符

sra 2008-02-24 02:51:21

declare @sql1 varchar(1000)
set @sql1='SELECT c.SignTime,sum(b.price) as PriceSum FROM table1 AS a INNER JOIN table2 AS b ON a.id=b.ServiceID INNER JOIN table3 AS c ON a.BasicInfoID=c.id WHERE b.ServiceTableName=''aaa'' AND a.BasicInfoID in (SELECT id FROM table3 WHERE State=1 AND Realcontract=1) GROUP BY c.SignTime'
exec @sql1


报错说“不是有效的标识符。”,请问该如何解决?
...全文
1134 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
qiubgstudy 2011-12-12
搞了半天终于出来了。
回复
johnnyuqx 2011-08-17
学习了
回复
chenhongcoo 2010-09-08
真是及时雨 刚遇到这个问题 牛人早有答案 看来不虚此行
回复
junmei_ 2009-07-02
遇见同样问题
回复
「已注销」 2009-01-05

回复
sra 2008-02-24
厉害,兄台牛人。结贴
回复
Limpire 2008-02-24
exec @sql1 --> exec (@sql1)
回复
Limpire 2008-02-24
declare @sql1 varchar(1000)
set @sql1='SELECT c.SignTime,sum(b.price) as PriceSum FROM table1 AS a INNER JOIN table2 AS b ON a.id=b.ServiceID INNER JOIN table3 AS c ON a.BasicInfoID=c.id WHERE b.ServiceTableName=''aaa'' AND a.BasicInfoID in (SELECT id FROM table3 WHERE State=1 AND Realcontract=1) GROUP BY c.SignTime'
exec (@sql1)
回复
相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2008-02-24 02:51
社区公告
暂无公告