Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Launch sql script within powerbuilder

311 views
Skip to first unread message

Alex Bibiano González

unread,
Sep 13, 2007, 3:31:56 AM9/13/07
to
Powerbuilder 10.5.1 and MS SqlServer 2005.

When my application first starts, I connect to the sql server with "sa"
credentials.

What I want to do is launch a sqlscript that I have in a text file (sql
sentences) to create a new database and his tables.

Any suggestions?

A lot of thanks,

Alex B.


André Tobiassen

unread,
Sep 13, 2007, 3:58:21 AM9/13/07
to

Check out using Dynamic Sql:

Execute Immediate s_SQLString Using transactionobject;

Read the file into a string (do any parsing necessary) and execute your
statement(s).

Regards
André


På Thu, 13 Sep 2007 09:31:56 +0200, skrev Alex Bibiano González
<abib...@nikel.es>:

Remigiusz Cieślak (EMATIQUE)

unread,
Sep 13, 2007, 3:59:42 AM9/13/07
to
Hi Alex,

The easiset way (perhaps not so sofisticated) is to iterate the commands
(after reading them from the file) and post them to the db via "execute
immediate".

http://www.rgagnon.com/pbdetails/pb-0024.html

Kind regards
recies

Użytkownik "Alex Bibiano González" <abib...@nikel.es> napisał w wiadomości
news:46e8e76c$1@forums-1-dub...

mason

unread,
Sep 13, 2007, 9:46:21 AM9/13/07
to
Run("sqlcmd.exe -S... -U... -P... -d... -b -imyscript.sql")

As others suggested, putting these DDLs in your PB codes is a better
approach. At least nobody can alter your myscript.sql to damage your
database.


"Alex Bibiano González" <abib...@nikel.es> wrote in message
news:46e8e76c$1@forums-1-dub...

0 new messages