Running bulk of SQL Scripts in Sybase through batch

前提是你 提交于 2019-12-13 04:28:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!