| Author |
Topic |
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-09 : 13:01:44
|
hi,I'm trying to call an SQL (.sql) file using ISQL from another one.sample of the statement that I have inside the first file:exec master..xp_cmdshell 'isql /Usa /P /iprint.sql /n'This fine when you call the file from cmd line windows and you are inside the folder where print.sql is stored.But the issue emerged when you are not in the folder where print.sql is stored.This is what I want to achieve:exec master..xp_cmdshell 'isql /Usa /P /ic:\myfolder\print.sql /n' any resolution to this please.Thanks--------------------------Joins are what RDBMS's do for a living |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-09 : 14:13:56
|
| version is SQL Server 2000I'm running the xp_cmdshell from within the cmd line of the server itself. I know the error is emerging only if i'm in a different foldereg:print.sql is saved under C:\tempcmd execution eg:c:\temp> isq /Usa /P /iprint.sql /nthis will run successfullyhowever,eg:print.sql is saved under C:\tempcmd execution eg:c:\> isq /Usa /P /iprint.sql /nthis will not recognize the file because it is not saved under C:Thanks--------------------------Joins are what RDBMS's do for a living |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-09 : 15:51:45
|
| Hey Tara, thanks for the supportI ran the following in SQL, it DOES NOT workexec master..xp_cmdshell 'osql -Usa -P -i c:\temp\audits\print.sql /n'Error: NO such file or DirectoryInstead when I run the following from cmd line it worksosql -Usa -P -i c:\temp\audits\print.sql /n--------------------------Joins are what RDBMS's do for a living |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-10 : 08:33:54
|
| I think I understand what you referring to! Yes, in both cases I'm running all command from a server. Nothing from a client machine. All the test are done locally in the server. Is this what you refer to? --------------------------Joins are what RDBMS's do for a living |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-10 : 15:25:40
|
when I ran this exec master..xp_cmdshell 'dir c:\temp\audits\' this is what I got. The system cannot find the file specified.NULL I'm sure there Folders/files with auditsIt is weird, right!--------------------------Joins are what RDBMS's do for a living |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
xhostx
Constraint Violating Yak Guru
277 Posts |
Posted - 2012-08-13 : 08:51:01
|
this command was ran from SQL2000exec master..xp_cmdshell 'dir c:\temp\audits\' how am I NOT local to the server?thanks--------------------------Joins are what RDBMS's do for a living |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|