Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Components Must be Installed to Get osql? 2

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hello all,

This question is for a 2005 installation.

I like to keep installations (of anything really) lean and mean. By that I like to install only what is needed.

On our application server, I installed only the client connectivity pieces - that enables the app to connect to the database which resides on another server. I didn't install the full Client tools which includes the Management tools.

Now we need to be able to use osql on the application server.

I know that the osql utility is part of the Client tools.
Does anyone know exactly which sub-component under Client tools I would need to install to get the osql tool?

Thanks, John

 
In SQL 2005 you use sqlcmd instead of osql.

- Paul
- If at first you don't succeed, find out if the loser gets anything.
 
Yes, in 2005 osql has been replaced by sqlcmd, but osql is still available. You can use either.

But I get "not a recognized command" when I try to run
sqlcmd.

Don't really want to install the Management tools et al just to get sqlcmd. It's kind of a security issue with me.

Maybe someone knows (mrdenny) what I need to install...

Thanks,
John
 
I think there are no external dependencies for oSQL (except for the SQL Server OLEDB driver). Perhaps you could just copy OSQL to the machine that it is not on. (It's worth a try).

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
After copying only the sqlcmd.exe to the server, kept getting errors for ".. missing file"

I just copied the entire \Resources folder (under Tools) and now sqlcmd works perfectly.

Thanks for the idea, George.

John
 
I think osql works standalone (no dependencies).

If you want to install sqlcmd, then you should....


Scroll down to: Microsoft SQL Server 2005 Command Line Query Utility

(Approximately 2.5 megs)



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
... hmmmm

When I want to use the sqlcmd, if I don't specify the exact path, it cannot find the command.

Even though I installed it into the same path that it's in on all the other servers (that have the management tools installed), C:\Documents and Settings\jbates>sqlcmd gives "sqlcmd is not a recognized command"

But on the servers that have the SQL Server management tools installed, the command is found and works.

I can't explain that. What am I missing?

Thanks, John

 
Path !

Do this...

Click Start -> run
Type CMD
CLick OK

At the DOS prompt, type: path (and then hit enter).

You'll notice that part of the path includes the folder where SQLCMD is.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I knew what the path to the .exe is.

On other SQL Servers when I run this:
C:\Documents and Settings\jbates>sqlcmd, it finds the sqlcmd.exe whereas on the server where I "manually" installed sqlcmd, the above will not find it - I have to specify the full and exact path to the .exe

I just wanted to know why the servers behave differently.

John
 
I think you are missing my point, so let me try and explain this another way.

When you run a DOS command, the operating system will look in the current folder to find the exe. If it's in the current folder, then good... it'll run it.

If the exe is not in the folder, then the operating system will look at the environment variable (named path) to find the exe. When you install SQL Server, it adds the path (where you install it to) to the path environment variable.

To see what I mean, on Windows XP....

Click Start -> Control Panel
Double Click System
Click the Advanced tab.
Click on 'Environment Variables'
In the 'System Variables' section, scroll down to Path.
Click once to highlight the path entry.
Click Edit.

You'll see this tiny little window that stores a really big string. It's usually best to copy/paste this to notepad or some other application that allows you see the whole thing. Mine looks like this...

[tt]C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\[/tt]

Each path is separated by a semi-colon. So, reformatting for human readability...

[tt]C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\system32\WBEM;
C:\Program Files\Microsoft SQL Server\80\Tools\BINN;
C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\90\Tools\binn\;
C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\[/tt]

Here's my point:

When you run an exe at a command prompt (without specifying the full path to the exe), the operating system will first check the current folder. If it's not there, it will look at the path environment variable. So, in my case, it will check C:\Windows\System32. If it finds the exe, it will run it. If not, it will check the next folder (C:\Windows). etc... It will continue checking all of the folders in the path variable. If it doesn't find it anywhere, it will not run the exe.

When you cannot run osql without specifying the whole path, it's because the path to the exe is not in the 'path' environment variable.

BTW... going to a command prompt and typing path is an easier way to see what your 'Path environment variable' is. [smile]

Does this make sense now?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Is it me or is this PC 101??

First off this
Maybe someone knows (mrdenny) what I need to install...

Why do you feel the need to point out specific members? Don't! it's rude. There are no ties to this site. Denny should not have to see his handle in a thread thus causing an unwanted sense of obligation. You've been around sense '00. You haven't gotten that yet? Slow?

Aside from the obvious, if you truly want the thinnest client you should use the providers built into the OS.

Going into this further even knowing I can see a dozen replies from it because people just don't seem to ever friggin listen, Paul gave you the correct path you needed to go down. osql.exe shipped with 2005 but it's deprecated. Fight the fact that sqlcmd replaced osql and was a very well deserved and awaited upgrade utility and you'll create more work for you or the next poor soul that has to pick up your hacked up work.

[sub]____________ signature below ______________
Backups are for sissies!!!!
coming to your keyboards soon[/sub]
 
Thanks for the detailed information, gmmastros.

Sometimes a 1,000 words is worth a couple of pictures :)


John
 
onpnt,

You are correct in saying I shouldn't expect a member to contribute to my thread, by naming him. I'll watch that in the future.

But when you post " osql.exe shipped with 2005 but it's deprecated. Fight the fact that sqlcmd replaced osql and was a very well deserved and awaited upgrade utility and you'll create more work for you or the next poor soul that has to pick up your hacked up work. ",

you don't know my circumstances. I'm aware of osql being depricated in 2005. This installation of 2005 serves a purchased system. From what the installation technicians tell me, it requires osql - can't use sqlcmd. I discussed this with them yesterday before I posted.

You have responded to several of my problems in the past - Thank you for your assistance. But in the future, feel free to avoid any post by JohnBates.

John

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top