Hi
Suppose I have a SQL script on a file. Can it call another script in the
same directory ?
Thanks in advance,
Fredrik
Suppose I have a SQL script on a file. Can it call another script in the
same directory ?
Thanks in advance,
Fredrik
You can use the SQL command
xp_cmdsell "isql -iScriptFile -Ooutfile -Sserver ..........."
but that's quite messy. You would probably be better off coding the
scripts as stored procedures.
Neil Boyle
--
www.impetus-sql.co.uk - Free SQL Server guide on-line
Not really. You can shell out from SQL Server to the operating system and execute
OSQL.EXE which can execute a script. But that file would be from the SQL Servers
perspective (and SQL Server does not know which directory your script happened to be
opened from).
EXEC xp_cmdshell OSQL.EXE /i...
--
Tibor Karaszi, SQL Server MVP
Please reply to the newsgroup only, not by email.
Quote:> Hi
> Suppose I have a SQL script on a file. Can it call another script in the
> same directory ?
> Thanks in advance,
> Fredrik
1. Easy question: where to run sql scripts?
Steve,
You can run the creation statement for a database from the context of the
master db. If you look at your script, you'll probably see a "USE <your db
name>" statement somewhere between the creation statement and any work on
the objects contained in the database. Once the USE statement gets
executed, the remaining statements will execute within the context of your
new db (or at least until "USE <some other db>" gets called <g>).
HTH,
Nicole
2. US.NY.WHITEPLAINS.PICK-MR.KING WHERE ARE YOU(KENDA Systems)
5. Easy question about Create Scripts
9. Easy script question: Connecting templates.
10. Give this newbe easy answers on easy questions!
12. Easy question on sql profiler