You are here: Re: How to Execute SQL Scripts using Batch file? « MsSQL Server « IT news, forums, messages
Re: How to Execute SQL Scripts using Batch file?

Posted by Dan Guzman on 10/12/07 11:31

> How can i give UserName,Password,Database and all those things?
>
> Plz send me details how to do that...if possible with example...

To expand on Erland's response, you can pass parameters on the command line
and reference using %1 through %9. The examples below execute all the
".sql" scripts in the current folder using the server, database, user and
password passed as command-line arguments.

FOR %%f IN(*.sql) DO SQLCMD -S %1 -d %2 -U %3 -P %4 -I -i "%%f"

FOR %%f IN(*.sql) DO OSQL -S %1 -d %2 -U %3 -P %4 -i "%%f"

--
Hope this helps.

Dan Guzman
SQL Server MVP

<raghutumma@gmail.com> wrote in message
news:1192032042.088785.7800@v3g2000hsg.googlegroups.com...
> Hi,
>
> How can we execute SQL Scripts using Batch file???
>
> i think Batch file should contain Username,Password,Database and
> Scripts...
> Using that file scripts should run...
>
> How can i give UserName,Password,Database and all those things?
>
> Plz send me details how to do that...if possible with example...
>
>
> Thanx in advance,
> RR...
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация