Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run sql stmt from a file

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
Hi,

I have a requirement to create a DTS job that will execute a number of create view sql stmts from a file. The sql stmt might change frequently so we want to maintain it here not edit the DTS job everytime.

An "Execute SQL Tasks" allows me to browse to the file but then imports the sql so no changes are picked up.

A "Copy SQL Server Objects" task seems to work as long as we could have some kind of authoritative database for the objects.

Does anyone know how this can be done from a .sql file? This users seem to prefer this method if it can be acheived.

Cheers
Jan
 
Run it via an osql command with the -i flag for the input file.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Hi Denny,

Thanks for your response. I've got this working. Was able to create a batch file and a dts job with an execute process task so that this can be run on a scheduled basis.

Thanks for your help.

Jan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top