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 Administration (2000)
 connecting with sqlcmd

Author  Topic 

SQLIsTheDevil
Posting Yak Master

177 Posts

Posted - 2008-07-10 : 11:03:18
I'm running sql server 2000. Now I cannot find the osql utility anywhere on the interweb. I downloaded sqlcmd, instead, even though it's for sql server 2005. I read that osql can be used with sql server 2005; there's an msdn article on backwards-compatibility between 2000 and 2005 tools. But it did not state that sqlcmd, a 2005 tool, can be used to connect to sql server 2000. Well, I tried it anyway and it worked...I navigated to microsoft.com and it does say sqlcmd is perfectly capable of connecting to 2000. Having said that, I have a few of questions.

1) My instance of SQL Server 2000 is configured for windows and sql authentication. On the client matchine, I have a few system DSNs, all of which are configured for sql authentication. So, when I type in sqlcmd -S [name of instance], it's connecting to sql server using windows authentication. But it's not connecting through the DSNs configured on my client system, right? If I wanted to connect to sql server 2000 via odbc:DSN connection, as opposed to connecting via sql server instance, how can I go about doing that?

2) I connected to an instance of sql server 2000 and did some basic select queries. Then I typed in "exit" and I was back to a dos prompt. Is this the proper way to close the connection? I wish to avoid any hanging database handlers that may cause problems. Should this be an issue?

Thank you very much.

Haywood
Posting Yak Master

221 Posts

Posted - 2008-07-10 : 17:15:38
1 - There is no way to connect sqlcmd/osql via a DSN.
1a - To use sql standard authentication, pass the -U (login) and -P (password) options to both utilities.

2 - Yes. There is no "disconnect" if you're using sqlcmd/osql in an ad-hoc manner.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-10 : 23:27:58
By the way, you can get help with 'osql /?' or 'sqlcmd /?' in dos prompt.
Go to Top of Page

SQLIsTheDevil
Posting Yak Master

177 Posts

Posted - 2008-07-11 : 08:51:08
Thank you very much.
Go to Top of Page
   

- Advertisement -