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 |
|
cajina
Starting Member
15 Posts |
Posted - 2008-01-03 : 17:52:22
|
How can I execute a sql script from other sql script? I used to call scripts from other scripts by using Oracle but I don't know if I can do this in SqlSever!I need anybody to help, please!
|
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-01-03 : 17:53:42
|
| You can use osql/sqlcmd to execute scripts via the command prompt. You can wrap them into batch files. You can also call these via xp_cmdshell if you have the permissions and the config setup (2005).Let us know more specifically what you mean and we'll be able to better direct you to the answer.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-01-08 : 04:05:29
|
| Yes, for example : EXEC master..xp_cmdshell 'osql -S MyServer -U sa -P -ic:\myScript.sql'(this script is on my c:Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2008-01-08 : 06:15:56
|
| it is better create a batch file with all the required script files paths. then at the run time, you can provide the server name,database name.(as TKIZER said)VinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
cajina
Starting Member
15 Posts |
Posted - 2008-01-08 : 10:26:10
|
| I realy don't remember but for example in Oracle I used to write something like this:prompt @script2.sqland it was written into the script1.sql |
 |
|
|
|
|
|