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
的方式)