Saturday, February 25, 2012

Run .SQL file

I have a whole bunch of update statments stored in a .sql
file. Is there any way to run it in the program (just pass
a filename)?
I know I can put the statments in a store procedure and
run the store procedure in the code such as
sqlcommand.commandtext="execute storeprocedure"
However, the database is in the client site and it's not
convient for them to change the store procedure. So I'd
like develop a functionality which can read and execute
the script file.
Any suggestion?
ThanksSee OSQL utility in BOL.
AMB
"Ying" wrote:

> I have a whole bunch of update statments stored in a .sql
> file. Is there any way to run it in the program (just pass
> a filename)?
> I know I can put the statments in a store procedure and
> run the store procedure in the code such as
> sqlcommand.commandtext="execute storeprocedure"
> However, the database is in the client site and it's not
> convient for them to change the store procedure. So I'd
> like develop a functionality which can read and execute
> the script file.
> Any suggestion?
> Thanks
>

No comments:

Post a Comment