Tuesday, February 21, 2012

running sql file

hi does sql server has any utility to run sql file from OS
level...Hi,
You can use the OSQL or ISQL utilities from command prompt to execute a SQL
file from command prompt.
Sample:
OSQL -Sserver_name -Usa -Ppassword -ic:\test.sql -oc:\output.log
(From command prompt execute OSQL/? to get all the options available)
Thanks
Hari
MCDBA
<anonymous@.discussions.microsoft.com> wrote in message
news:f96d01c43e32$21fafbc0$a001280a@.phx.gbl...
> hi does sql server has any utility to run sql file from OS
> level...|||If you have the sql client utilities installed then look into using osql
command line utility for the same.
--
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
<anonymous@.discussions.microsoft.com> wrote in message
news:f96d01c43e32$21fafbc0$a001280a@.phx.gbl...
> hi does sql server has any utility to run sql file from OS
> level...|||Thanks..Is it possible to run a script from stored
procedure?
>--Original Message--
>Hi,
>You can use the OSQL or ISQL utilities from command
prompt to execute a SQL
>file from command prompt.
>Sample:
>OSQL -Sserver_name -Usa -Ppassword -ic:\test.sql -
oc:\output.log
>(From command prompt execute OSQL/? to get all the
options available)
>Thanks
>Hari
>MCDBA
><anonymous@.discussions.microsoft.com> wrote in message
>news:f96d01c43e32$21fafbc0$a001280a@.phx.gbl...
>> hi does sql server has any utility to run sql file from
OS
>> level...
>
>.
>|||Hi,
Yes, it is possible to do using xp_cmdshell.
Sample:-
alter proc test_proc
as
begin
exec master..xp_cmdshell
'osql -Usa -Ppassword -Sserver_name -ic:\hari.sql -oc:\hari.log'
end
Thanks
Hari
MCDBA
<anonymous@.discussions.microsoft.com> wrote in message
news:f99701c43e39$eed68270$a001280a@.phx.gbl...
> Thanks..Is it possible to run a script from stored
> procedure?
> >--Original Message--
> >Hi,
> >
> >You can use the OSQL or ISQL utilities from command
> prompt to execute a SQL
> >file from command prompt.
> >
> >Sample:
> >
> >OSQL -Sserver_name -Usa -Ppassword -ic:\test.sql -
> oc:\output.log
> >
> >(From command prompt execute OSQL/? to get all the
> options available)
> >
> >Thanks
> >Hari
> >MCDBA
> >
> ><anonymous@.discussions.microsoft.com> wrote in message
> >news:f96d01c43e32$21fafbc0$a001280a@.phx.gbl...
> >> hi does sql server has any utility to run sql file from
> OS
> >> level...
> >
> >
> >.
> >

No comments:

Post a Comment