我有程序
create procedure dbo.updateView(@cobdate datetime)
as
begin
Update hir_view set ValidTo=@cobdate where HierarchyId in (
select distinct HierarchyId from hir_organisation where ValidTo<getDate() and HierarchyId not in (
select HierarchyId from hir_organisation where ValidTo>getDate()
)
) and ValidTo>getDate()
end
go
当我尝试使用
调用它时exec updateView(
convert(
dateTime,'20160209')
);
我收到错误说明 查找错误 - 消息156,级别15,状态34,服务器DSLNPHX02,第18行 - Sybase数据库错误:关键字附近的语法不正确&#39;转换&#39;。
我不确定我哪里出错了
答案 0 :(得分:0)
语法正确,您是否尝试过像这样运行更新命令
convert(dateTime,'20160209')
Update hir_view set ValidTo=convert(dateTime,'20160209') where HierarchyId in (
select distinct HierarchyId from hir_organisation where ValidTo<getDate() and HierarchyId not in (
select HierarchyId from hir_organisation where ValidTo>getDate()
)
) and ValidTo>getDate()