0

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'!!

Praveenks
  • 1,436
  • 9
  • 40
  • 79

1 Answers1

0

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.

Mike Gardner
  • 6,611
  • 5
  • 24
  • 34
  • Just a query..In sql server we don't use port number to connect to a database server but in sybase we do use port number..so should i need to add that in my .bat file and if yes then how? – Praveenks Apr 30 '13 at 16:23
  • 1
    Do you have the Sybase client installed on your system? If so then you need to put the Server information (Servername, hostname, port number) in the sql.ini file, which is usually located in the Sybase home directory. **isql** uses that to resolve the -S[ServerName] value to a host/port. – Mike Gardner Apr 30 '13 at 16:27