Sql JDBC insert/update命令中有什么错误
这是关于一个简单的预订/预订表:键是预订时间和预订日期的anId 但当我尝试执行以下操作时:如果不存在,则插入,如果存在,则更新,关于使用以下代码链接到时间的标识符:Sql JDBC insert/update命令中有什么错误,sql,sql-server,jdbc,jtds,Sql,Sql Server,Jdbc,Jtds,这是关于一个简单的预订/预订表:键是预订时间和预订日期的anId 但当我尝试执行以下操作时:如果不存在,则插入,如果存在,则更新,关于使用以下代码链接到时间的标识符: declare anId varchar[18]; declare aDate; declare aTimeStamp; set @anId =?; set @aDate=?; set @aTimeStamp=?; if (exists (select * from Booking as t where t.AnId = @an
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.
你知道怎么回事吗?你应该把@作为变量名
declare @anId varchar(18);
declare @aDate datetime;
declare @aTimeStamp datetime;
我想还必须提供型号?正确的Rory!我快速复制并粘贴:)