Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hydtohou
Starting Member
24 Posts |
Posted - 2005-08-08 : 19:39:02
|
| Hi , What DTS Task Should be used to RUN SQL SCRIPTS. I know that I can use EXECUTE SQL TASK. But my problem is that I have to dynamically read the name of the Script file and then run it.Can any one give me ideas ,It's somewhat urgent |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2005-08-08 : 20:49:48
|
| If you must use DTS, then probably the best thing would be to use an Execute Process task. Then you can execute your script file by calling the command line utility isql.exe and pass in the script file to be run. Check out BOL for details on how to execute a script file with isql. You can use parameters in the Execute Process task to pass in the filenameAlternately, you could create an ActiveX task that:-Reads in the script file-Separates it into distinct commands (i.e. split it up using 'GO' as the delimiter)-Execute each command in turn using ADO. The first option would be preferable, but the second option gives you more control but would take longer to write/debug.HTH,Tim |
 |
|
|
|
|
|