Beginner question: run .sql

  • Thread starter Thread starter Carlo Marchesoni
  • Start date Start date
C

Carlo Marchesoni

I'm starting with ADO.NET and I found several samples
where they ask to run .sql files (for creating stored
procedures or so).
I have the MSDE SQL Desktop engine and do not know how to
run a sql script for this DB.
Can I do it from inside VS.net ?
Thanks
 
Hi,

You can use the commandline tool osql.exe, if you execute this command with
the /? switch you will get the basic help on how to use it. The following
should get you started

osql -S servername -U username -P password -d databasename -i script.sql

If you are using a trusted connection i.e Windows Authentication

osql -E -d databasename -i script.sql

If the script is also creating the database then you can omit the -d switch.

Hope this helps

Chris Taylor
 
Hi,

You could try to do it from VS.Net.
1. create a DataBase Project.
2. Add a sql script file into the project.
3. right click the file to run or run at.

Bin Song, MCP
 
This helps, thanks a lot
-----Mensaje original-----
Hi,

You could try to do it from VS.Net.
1. create a DataBase Project.
2. Add a sql script file into the project.
3. right click the file to run or run at.

Bin Song, MCP

.
 
This is the thing I like, although you can do it from
within VS.NET, I prefer the command line interface.
Thanks a lot for your help
 
Back
Top