Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 add login name and password in osql

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-02-08 : 06:02:48
I use osql to find out the number of record:

osql -E -d ORDER -S DATASERVER -Q "select COUNT(*) from Order_Activity" >> c:\log.txt

It works fine. Now, DATASERVER need login name and password, how to modify command above?

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-02-08 : 06:12:12
Hi,
Use -U and -P option for specifying User Id and Password

osql -E -d ORDER -U LoginId -P password -S DATASERVER -Q "select COUNT(*) from Order_Activity" >> c:\log.txt
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-02-08 : 06:22:31
And drop the "-E" (which is used for a Trusted Connection)

Just type OSQL for a list of command line switches

Kristen
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-02-08 : 06:24:42
Thank you.
First run, got error: Conflicting switches : -U and -E
After delete -E, it works fine.
Go to Top of Page

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-02-08 : 06:46:49
missed that in copy paste.. :(
Go to Top of Page
   

- Advertisement -