Board index » delphi » MS-SQL Server Create DB

MS-SQL Server Create DB

greetings for the day,

I have generated SQL Script for my existing MS-SQL server database using
Generate SQL Script option in the MS-SQLserver.

Can anyone help me out how write a utility which will read the sql script
file and create database from delphi..

sudhaker

 

Re:MS-SQL Server Create DB


Quote
Sudhaker <sudha...@botree.co.in> wrote in message news:3c637043_1@dnews...
> I have generated SQL Script for my existing MS-SQL server database using
> Generate SQL Script option in the MS-SQLserver.

> Can anyone help me out how write a utility which will read the sql script
> file and create database from delphi..

If you just want to run the script, you can use the osql utility that ships
with sql server to run it. e.g.

osql -E -S localhost -n -i CreateTestDB.sql

See SQL Server's help (BOL) for all the options, e.g. -U -P for specifying
user name/password.

Regards,
Andy Mackie.

Re:MS-SQL Server Create DB


If you want to build it into an application, then one way is to use
TADOConnection and TADOCommand. If you use GO in your script then you will
have to read the bacthsections (eg. the statements separated by GO) from
file and execute it bacth by batch.
If you use BDE then have a look at RX components, who have a component which
takes a batch script.

Regards,
Bertrand Bourgeat

"Andy Mackie" <amac...@citynetworks.co.uk> skrev i en meddelelse
news:3c639f3a$1_1@dnews...

Quote
> Sudhaker <sudha...@botree.co.in> wrote in message news:3c637043_1@dnews...
> > I have generated SQL Script for my existing MS-SQL server database using
> > Generate SQL Script option in the MS-SQLserver.

> > Can anyone help me out how write a utility which will read the sql
script
> > file and create database from delphi..

> If you just want to run the script, you can use the osql utility that
ships
> with sql server to run it. e.g.

> osql -E -S localhost -n -i CreateTestDB.sql

> See SQL Server's help (BOL) for all the options, e.g. -U -P for specifying
> user name/password.

> Regards,
> Andy Mackie.

Re:MS-SQL Server Create DB


Check out CodeCentral #17523

http://ww6.borland.com/codecentral/

-Jim

Quote
"Sudhaker" <sudha...@botree.co.in> wrote in message news:3c637043_1@dnews...
> greetings for the day,

> I have generated SQL Script for my existing MS-SQL server database using
> Generate SQL Script option in the MS-SQLserver.

> Can anyone help me out how write a utility which will read the sql script
> file and create database from delphi..

> sudhaker

Other Threads