3.5.10

Executing SQL Scripts using SQL Server

Today, One of my friend have asked about executing a set of script files in SQL Server 2000.
In Oracle, we can execute the scripts by using @ command.

>@script1.sql
>@script2.sql

But, in SQL Server we can't acheieve it directly. Let's see a simple approach to achieve it.

Step 1: Change the sql file into a cmd file.

Step 2: Create another file with bat extension, and type your command

isql -U(UserName) -P(your Password) -i "File path"


Execute your batch file in the command prompt.


Else, You can create SSIS package and loop through your sql files.
Cheers,
Venkatesan Prabu .J

No comments:

Post a Comment