下面的脚本有什么问题?

时间:2015-10-07 13:29:20

标签: sql sybase-ase

declare @param int

    if not exists (select * from PostingDefinition where id='postnbr' and map_addr like 'Subledger')
    begin
        execute GetNewRowId @table_name = 'PostingDefinition', @max_row = @param output
        insert into PostingDefinition values (@param,'postnbr','Subledger','Posting #','int')
    end
    if not exists (select * from PostingDefinition where id='source' and map_addr like 'Subledger')
    begin
        execute GetNewRowId @table_name = 'PostingDefinition', @max_row = @param output
        insert into PostingDefinition values (@param,'source','Subledger','Source','char')
    end
go

当我在Sybase 15.7上运行此脚本时,它给出了一个错误:

Msg 208, Level 16, State 1:
Server 't6', Line 4:
PostingDefinition not found. Specify owner.objectname or use sp_help to check
whether the object exists (sp_help may produce lots of output).
Msg 208, Level 16, State 1:
Server 't6', Line 7:
PostingDefinition not found. Specify owner.objectname or use sp_help to check
whether the object exists (sp_help may produce lots of output).

如果我在脚本末尾删除了go语句,那么它可以正常工作。

注意:上面脚本中的GetNewRowId是我定义的一个过程,它生成了表的下一行id(一种生成primary key的方式)

0 个答案:

没有答案