任何人都可以帮助我吗?
我不知道为什么以下SQL会出现语法错误:
if not exists (select 1 from sysobjects where type='U' and name='pg_result')
create table pg_result (parent char(10), child char(10))
else
delete from pg_result
end if
我收到以下错误:
[错误]脚本行:141-146
关键字'end'附近的语法不正确。
消息:156,等级:15,状态:2
服务器:SYBDEV,Line:5
我正在跑步:
Adaptive Server Enterprise / 12.5.4 / EBF 16785 ESD#10 / P / Sun_svr4 / OS 5.8 / ase1254 / 2159/64位/ FBO / Mon Nov 2 13:08:08 2009
有什么想法吗?
答案 0 :(得分:2)
如果您不使用end
begin
答案 1 :(得分:1)
尝试
if not exists (select 1 from sysobjects where type='U' and name='pg_result')
create table pg_result (parent char(10), child char(10))
else
delete from pg_result
或
if not exists (select 1 from sysobjects where type='U' and name='pg_result')
begin
create table pg_result (parent char(10), child char(10))
end
else
begin
delete from pg_result
end