?
Solved

executing osql.exe

Posted on 2005-04-29
3
Medium Priority
?
602 Views
Last Modified: 2012-06-21
I am using osql command to execute a batch file to update my database

@echo off
osql.exe -d dbname -U username -P password -i C:\Program Files\Test Systems\Application Windows\Working\Batchfile.sql -Q


I am not sure to whether the command is executed correctly. Is it possible to write the output in a text file or see the result window?

Thanks in advance for your help
0
Comment
Question by:veshan
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Jan Franek earned 1000 total points
ID: 13892720
Try this:

osql.exe -d dbname -U username -P password -i C:\Program Files\Test Systems\Application Windows\Working\Batchfile.sql -o C:\Program Files\Test Systems\Application Windows\Working\Batchfile.log -Q
0
 

Author Comment

by:veshan
ID: 13892745
Thanks a lot.
Does blank spaces (C:\Program Files\Application Windows\...\ in the file path ?
0
 
LVL 14

Expert Comment

by:Jan Franek
ID: 13892753
Yes, the blank spaces could cause you a problem - enclose it in ":

osql.exe -d dbname -U username -P password -i "C:\Program Files\Test Systems\Application Windows\Working\Batchfile.sql" -o "C:\Program Files\Test Systems\Application Windows\Working\Batchfile.log" -Q
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question