Running another script from within a script

In Oracle I simply use the
@c:\script.sql command
How do I execute another script from within a script in SQLServer?

Thanks
orcl8i_dba_2000Asked:
Who is Participating?
 
Jay ToopsCommented:
Note you can create a string and modify it VIA sql withing your code ...
0
 
Brian CroweDatabase AdministratorCommented:
I'm not familiar with Oracle but it sounds like you're trying to call one stored procedure from with another.

CREATE PROCEDURE myProc
     {parameters}
AS

...
EXECUTE myOtherProc {parameter1, parameter2, ...n}
...
GO
0
 
orcl8i_dba_2000Author Commented:
I am trying to call sqlfile2.sql from inside sqlfile1.sql
0
 
Jay ToopsCommented:
You can use osql or isql utility to run SQL script located on the disk file. This is the example to run SQL script located in the C:\SQLScript.sql file:

EXEC master..xp_cmdshell 'osql -S Servername -U sa -P -ic:\SQLScript.sql'

See SQL Server Books Online for more information about osql or isql utility and about xp_cmdshell extended stored procedure.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.