Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: how to run a sql script generated by the enterprise manager ?



Hi Eric

I do this by reading the script file into a string, and parsing the string into
batches using "GO" + CRLF as the delimiter.  Then I execute each batch
individually.

hth's
Richard

Eric Hourant wrote:

> Hello All,
> The enterprise manager can generate scripts for files maintenance. How is it
> possible to run those scripts from VO ?
>
> The scripts are similar to :
>
> /*
> comments area
> */
> BEGIN TRANSACTION
> SET QUOTED_IDENTIFIER ON
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
> SET ARITHABORT ON
> SET NUMERIC_ROUNDABORT OFF
> SET CONCAT_NULL_YIELDS_NULL ON
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> COMMIT
> BEGIN TRANSACTION
> CREATE TABLE dbo.Tmp_CON1
>  (
>  C1_NUMINT int NOT NULL IDENTITY (1, 1),
>  C1_JOURNAL char(4) NULL,
> ...
>  )  ON [PRIMARY]
> GO
> SET IDENTITY_INSERT dbo.Tmp_CON1 ON
> GO
> ...
> COMMIT
>
> I have tried to read the script into a variable and execute it with an
> AdoCommand but it returns an error message.
>
> oAc :=AdoCommand{}
> oAC:ActiveConnection :=GetAppObject():oESConn
> oAC:CommandText  :=cSql
> oAC:Execute( NIL, NIL, NIL)
>
> Do I need to strip of all the comments and GO statements from the script
> before running it ?
>
> TIA
>
> Eric




<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.