[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 602
  • Last Modified:

call one SQL script from another

I want to call one SQL script from another.  Can this be done?  

What I want is a main script that does nothing more then make calls to other scripts.
0
HLRosenberger
Asked:
HLRosenberger
  • 3
1 Solution
 
Simone BCommented:
I would normally create "other" scripts as stored procedures. Then the main script can call the stored procedures.

For example:

Create procedure Mainproc
as begin

Declare @a int
Declare @b int

set @a = blahblah1
set @b = blahblah2

If @a = @b

exec otherproc1

else
exec otherproc2

end
0
 
HLRosenbergerAuthor Commented:
But I do not want to create procs.   These are just external scripts.
0
 
HLRosenbergerAuthor Commented:
I'm gonna use the sqlcmd in a batch file to call each script.
0
 
HLRosenbergerAuthor Commented:
This is the way I choose to go...
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now