Hello everyone.
I'm trying to automate the initial installation of a sql database from a VB program. I have an osql command that works fine from a command line: osql -E -iMyFileName.sql.
Now, Shell "osql -E -iMyFileName.sql" doesn't work, and neither does opening an ADO connection cn and doing cn.execute "xp_cmdshell 'osql -E -iMyFileName.sql'". So, I opened the query analyzer and gave it the command xp_cmdshell 'osql -E -iMyFileName.sql'
which gave me the output "Cannot open file - MyFileName.sql", No such file or directory, NULL, on lines 1, 2 and 3 respectively.
Why can't the shell context find the file, when the command line prompt can, assuming that's what's really happening? If there's a better way to run an .sql input file automatically, can someone tell me?
Thanks,
Bob Rodes
I'm trying to automate the initial installation of a sql database from a VB program. I have an osql command that works fine from a command line: osql -E -iMyFileName.sql.
Now, Shell "osql -E -iMyFileName.sql" doesn't work, and neither does opening an ADO connection cn and doing cn.execute "xp_cmdshell 'osql -E -iMyFileName.sql'". So, I opened the query analyzer and gave it the command xp_cmdshell 'osql -E -iMyFileName.sql'
which gave me the output "Cannot open file - MyFileName.sql", No such file or directory, NULL, on lines 1, 2 and 3 respectively.
Why can't the shell context find the file, when the command line prompt can, assuming that's what's really happening? If there's a better way to run an .sql input file automatically, can someone tell me?
Thanks,
Bob Rodes