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
 Transact-SQL (2000)
 OSQL with a data source

Author  Topic 

pareshmotiwala
Constraint Violating Yak Guru

323 Posts

Posted - 2003-04-02 : 10:44:24
Per books online, you can select a datasource for an OSQL command by a switch -D.

I am using OSQL -iC:\script.sql -Dabc.dsn -oC:\results.txt

I am not sure if this DSN should file or system, which I don't know, so I tried both.

It returns an error. "Error: No user selected. Try with -U or -E switches

But if I use the -E option ,it produces the results.

Anybody have ideas????


royv
Constraint Violating Yak Guru

455 Posts

Posted - 2003-04-02 : 12:30:25
I have noticed this with ODBC, that you would still need to provide the username and password. I believe this is where your problem lies.

***************************************
Death must absolutely come to enemies of the code!
Go to Top of Page

pareshmotiwala
Constraint Violating Yak Guru

323 Posts

Posted - 2003-04-02 : 13:31:51
I found it.
I had to create a system DSN.
Then use -E switch before the -D switch.
I was able to run a long running script with this.
So although, the DSN was a system DSN with Trusted Login(tested), OSQL still needs to be informed that it must use trusted connection using -E.

It however did not work with non-trusted connection.

Go to Top of Page
   

- Advertisement -