0

这是一个简单的预订/预订表:key 是 timeOfBooking 和 dateOfBooking 的 anId。

但是,当我尝试这样做时:插入 if-not-exist,更新 if-exist,关于与此代码链接到时间的标识符:

declare anId varchar[18];
declare aDate;
declare aTimeStamp;
set @anId =?;
set @aDate=?;
set @aTimeStamp=?;
if (exists (select * from Booking as t  where t.AnId = @anId ))
begin update Booking set Date = @aDate and Time = @aTimeStamp  where AnId= @anId end
else begin insert into Booking (AnId, Date, Time) values(@anId , @aDate, @aTimeStamp) end ; 

我最终得到 jdbc 层返回此错误:

'varchar' is not a recognized CURSOR option.

知道有什么问题吗?

4

1 回答 1

2

你应该把@作为变量名

declare @anId varchar(18);
declare @aDate datetime;
declare @aTimeStamp datetime;
于 2012-05-21T16:29:41.730 回答