【问题标题】:Incorrect syntax near the keyword 'convert'关键字“convert”附近的语法不正确
【发布时间】:2016-02-09 20:31:31
【问题描述】:

我有程序

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 数据库错误:关键字“convert”附近的语法不正确。

我不知道我哪里错了

【问题讨论】:

    标签: stored-procedures sybase


    【解决方案1】:

    语法正确,你有没有试过这样运行更新命令

    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()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-08
      • 2013-12-16
      • 2017-11-22
      • 1970-01-01
      • 2018-06-16
      • 2013-10-29
      • 2014-06-22
      • 1970-01-01
      相关资源
      最近更新 更多