首页 新闻 会员 周边 捐助

sql server中表名User与关键字或保留字相同 创建存储过程时不能创建,怎么解决?

0
悬赏园豆:5 [已关闭问题] 关闭于 2011-11-15 20:30
ALTER PROCEDURE ProcDeleteUser
@userID int
AS
/* SET NOCOUNT ON */
update Projects set UserID=null where UserID = @userID
delete from User where UserID =@userID
RETURN

保存时提示User附近有错误!据说在在表名前加上架构名可行,[架构名].[表名]这架构名是什么呢?

SatanRabbit的主页 SatanRabbit | 初学一级 | 园豆:114
提问于:2011-11-15 19:45
< >
分享
所有回答(2)
0
把User用中括号括起来
SatanRabbit | 园豆:114 (初学一级) | 2011-11-15 20:29
0
ALTER PROCEDURE [dbo].[ProcDeleteUser]
@userID int
as
BEGIN
  update Projects set UserID=null where UserID = @userID
 delete from [User] where UserID =@userID
  RETURN
END

定义与关键字相同的标识时用[]包起来

zemin1 | 园豆:180 (初学一级) | 2011-11-15 20:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册