问题
I was using below code(as .bat file) to recursively execute the bulk of .sql files, having SQL SERVER 2008 R2 as backend:
for /R %%G in (*.sql) do sqlcmd /S [Database Server] /d [Database name] -U [Username] - P[Password] -i"%%G"
pause
Now, i i have to execute bulk of sql scripts but this time Sybase as backend.
Please suggest me what modification should i do to make it run for 'Sybase'!!
回答1:
The connection string for Sybase is very similar
isql -U [username] -P [password] -S [servername] -D [dbname] -i [scriptname]
So your script will look something like:
for /R %%G in (*.sql) do isql -S ServerName -D DbName -U Username -P Password -i"%%G"
pause
It should require minimal changes to get it to work on Sybase vs SQLServer.
来源:https://stackoverflow.com/questions/16300180/running-bulk-of-sql-scripts-in-sybase-through-batch