J
jesse.zhou
Unregistered / Unconfirmed
GUEST, unregistred user!
文本文件如下A.TXT:
IF EXISTS(SELECT * FROM SYSOBJECTS WHERE NAME='AA' AND XTYPE='P')
DROP PROCEDURE AA
GO
IF EXISTS(SELECT * FROM SYSOBJECTS WHERE NAME='A1' AND XTYPE='U')
DROP TABLE A1
GO
CREATE TABLE A1(
AAA INT) ON [PRIMARY]
CREATE PROCEDURE AA
AS
SELECT * FROM A2
GO
程序:
STRPATH:=EXTRACTFILEPATH(PARAMSTR(0))+'/TXT/A.TXT';
ADOQUERY1.Close;
ADOQUERY1.SQL.Clear;
ADOQUERY1.SQL.LoadFromFile(STRPATH);
TRY
ADOQUERY1.ExecSQL;
SHOWMESSAGE('創建成功');
EXCEPT
ON E:EXCEPTION DO
BEGIN
SHOWMESSAGE(E.Message);
RAISE;
END;
END;
1.如像不能用GO
2.如果去掉GO則提示"CREATE PROCEDURE" MUST BE THE FIRST STATEMENT IN A QUERY BATCH"
IF EXISTS(SELECT * FROM SYSOBJECTS WHERE NAME='AA' AND XTYPE='P')
DROP PROCEDURE AA
GO
IF EXISTS(SELECT * FROM SYSOBJECTS WHERE NAME='A1' AND XTYPE='U')
DROP TABLE A1
GO
CREATE TABLE A1(
AAA INT) ON [PRIMARY]
CREATE PROCEDURE AA
AS
SELECT * FROM A2
GO
程序:
STRPATH:=EXTRACTFILEPATH(PARAMSTR(0))+'/TXT/A.TXT';
ADOQUERY1.Close;
ADOQUERY1.SQL.Clear;
ADOQUERY1.SQL.LoadFromFile(STRPATH);
TRY
ADOQUERY1.ExecSQL;
SHOWMESSAGE('創建成功');
EXCEPT
ON E:EXCEPTION DO
BEGIN
SHOWMESSAGE(E.Message);
RAISE;
END;
END;
1.如像不能用GO
2.如果去掉GO則提示"CREATE PROCEDURE" MUST BE THE FIRST STATEMENT IN A QUERY BATCH"