32bit OSQL issue with 64bit Windows+64bit SQL Server - sql-server

I have a Windows 2008 x64 server and with SQL Server 2008 x64 installed. osql.exe under SQL Server directory could list instances with -L. I copied osql.exe+osql.rll from another SQL Server 2005 x86 and '.\osql.exe -L' returns error like "[ODBC Driver Manager] Data source name not found and no default driver specified".
After check registry 'HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI', the 'SQL Server' and 'SQL Server Native Client 10.0' are ok and related dll files are ok. I also checked MDAC version, it's 6.0.6002.18005. Did i miss anything?
One interesting thing is osql.exe from SQL Server 2000 ran well to list instances on the server. And osql.rll isn't necessary, the osql.exe only needs msvcr71.dll.
What can i do to make osql.exe(from sql 2005) to run on the server? And are there any difference between those 2 osql.exe(sql 2005, sql 2000)?

As DaveShaw said, you should probably be using SQLCMD.EXE instead... fortunately the syntax is quite comparable to the old OSQL.EXE, so the transition shouldn't be hard.
You can download SQLCMD (a/k/a the Microsoft SQL Server 2005 Command Line Query Utility) from the latest Feature Pack for SQL Server 2005 page. Install the appropriate SQLCMD and the SQL Server Native Client (also on the same page) and you can run the commands from any client system on the network, x86 or x64 no matter.

Related

What do I need to execute a SQL Server PowerShell module

I am creating an Octopus deploy that installs a windows service on a remote server. I am re-using a template from a web deploy project that sets up the web services and web application (on other servers). It has an extra step that deploys database scripts to update the schema and stored procedures etc. This step is executed on the web server using SQL Server PowerShell tools (apparently).
I need to incorporate that as well into my project. The folks who set up the original project are long gone! I have managed to get it working up to the last step, however the SQL Server PowerShell tools needed on the new server are not available.
The database script step is throwing the following error.
Import-Module : The specified module 'C:\Program Files\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS' was not loaded because no valid module file was found in any module directory.
At C:\Octopus\Work\20160930164655-24\.ps1:1 char:14
The necessary folders and files exist on the web server. It looks like SQL Server Client is not installed though (judging by the start menu; I don't see SQL Server Management Studio for example).
In Programs and Features on the web server I see a bunch of SQL Server things:
Microsoft SQL Server 2012 Command Line Utilities
Microsoft SQL Server 2012 Data tier App Framework
Microsoft SQL Server 2012 Express LocalDB
Microsoft SQL Server 2012 Management Objects
Microsoft SQL Server 2012 Management Objects (x64)
Microsoft SQL Server 2012 Native Client
Microsoft SQL Server 2012 Transact-SQL Compiler Service
Microsoft SQL Server 2012 Transact-SQL ScriptDom
Microsoft SQL Server 2012 Transact-SQL Language service
Microsoft SQL Server 2012 TSQL Language service
Microsoft SQL Server Comnpact 4.0 SP1 x64 ENU
Microsoft SQL Server Data Tools - enu(11.1.20627.00)
Microsoft SQL Server Data Tools - Build Utilities - enu (11.1.20627.00)
Microsoft SQL Server System CLR Types
Microsoft SQL Server System CLR Types (x64)
Microsoft SQL Server System CLR Types for SQL Server 2012
Microsoft SQL Server System CLR Types for SQL Server 2012 (x64)
Windows Powershell Extensions for SQL Server 2012
I need to raise an IT ticket to get this set up on my new server but don't know what to ask for! What installation(s) would give me the above features? Or what install would allow me to execute that script?
Would the SQL Server Client 2012 suffice?
Note: the server I need to install on is 32 bit.
SQLPS is auto installed in sql server 2012. The old versions need to install it from download Featurpack.
It's installed normally for sql server 2012 in the folder:
c:\Program Files\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS
If it's not available in that path require installing:
Microsoft Windows PowerShell Extensions for Microsoft SQL Server 2012
It's availabl at url:
32 bit:
64 bit:
in Poweshell 3 you can run the command (without path):
Import-Module Sqlps -DisableNameChecking;
and it's valid if you use the path
Invoke-Sqlcmd is similar to the command line tool sqlcmd
You can run your script file using the command:
sqlcmd -S <server> -U <user> -P <password> -i <qry.sql>
What you seek is the Microsoft SQL Server 2012 Feature Pack, available here:
https://www.microsoft.com/en-us/download/details.aspx?id=29065
If you expand the "Install Instructions" section, and then scroll about halfway down the page, you will see that one of the components listed there is the PowerShell Extensions, which contains the SQLPS module. Note that this component depends on the Shared Management Objects component (also on the same page), which in turn depends on CLR Types (also on the page, but at least that one is already installed on your server).
There are different versions available for other versions of SQL Server:
SQL Server 2014: https://www.microsoft.com/en-us/download/details.aspx?id=42295
SQL Server 2016: https://www.microsoft.com/en-us/download/details.aspx?id=52676

How to install sql2005 on sql2008r2?

I am poorly experienced in SQL Server installations. I have already installed 2008r2 on Microsoft Windows 8.
Now I want to install MS SQL Server 2005, but I need both MS SQL Server 2008r2 and MS SQL Server 2005.
How can I install this?
You can install both versions on same computer..
From MSDN:
SQL Server supports multiple instances of the Database Engine, Analysis Services, and Reporting Services on the same computer. You can also upgrade earlier versions of SQL Server, or install SQL Server on a computer where earlier SQL Server versions are already installed.
There's a couple of problems here; firstly SQL 2005 isn't even compatible with Windows 8. Windows 7 you can just about get away with it with some patching. Next you need to install the instances and tools in version order. So SQL 2005, then SQL 2008.
You could try uninstalling SQL2008, but you'll probably find too many updates and bits have occurred to get back to a state that might allow you to try doing SQL2005.
My recommendation would be; format the host machine. Install Windows 8. Setup HyperV virtual machines for each version of SQL Server in an operating system that's more inline with the SQL product. Eg. Win2003 for SQL2005. Win2008 for SQL 2008.
He's a block post of doing this to create a manageable developer workstation running every version of SQL Server: http://www.purplefrogsystems.com/paul/2016/05/using-hyper-v-and-powershell-to-create-the-perfect-developer-workstation/

How to run sqlcmd remotely on a machine which does not have SSMS

Is there a way in which we can run sqlcmd on a machine without having SSMS.
If you follow this link for Microsoft SQL Server 2008 R2 Feature Pack , you should be able to download it for the machine without needing to install SQL server.
Also, see this link for Microsoft Command Line Utilities 11 for SQL Server
which might be better.

Minimum requirements to run Sql Server BCP.exe utility

I am working with a client who needs to do a data import to a remote SQL Server (2008) instance. The machine that the import will be done from cannot have SQL Server installed on it. Can the BCP.exe utility run without a SQL Server install?
Thanks for any help.
BCP relies on some basic DLLs. Why don't you try installing client tools and run BCP from there. It will be a pretty clean server without SQL installed.
http://www.mssqltips.com/sqlservertip/1807/sql-server-2008-client-tools-installation/
I got a great answer over at https://dba.stackexchange.com/.
Answer
2015 - Installed on Windows Server 2008 R2 SP1
I needed the ODBC driver installed first...
Microsoft® ODBC Driver 11 for SQL Server
http://www.microsoft.com/en-za/download/details.aspx?id=36434
Microsoft® Command Line Utilities 11 for SQL Server
http://www.microsoft.com/en-za/download/details.aspx?id=36433
p.s. In case you're reading this post and the year is > 2015, use the search to find a similar download:
http://www.microsoft.com/en-za/search/DownloadResults.aspx?q=Microsoft%20Command%20Line%20Utilities

Error while connecting remotely

i m using sql server 2005 with service pack-2.
When I connect sql server with by registering the remote server with IP, username and password. I have done all the neccessary setting for connecting remotely "SQL Server 2005 Surface Area Configuration".
i got following error while connection:
This version of Microsoft SQL Server Management Studio can only be used to connect to SQL Server 2000 and SQL Server 2005 servers. (ConnectionDlg)
Can you please provide me possible reasons for the above mentioned error.
Thanks,
Saurabh
I would also add that this can also happen if you are trying to connect to a lower version too!
I would also suggest checking which version of SQL 2005 you are attempting to connect to and make sure it is a RTM or higher, and not an older CTP release.
The other possibility is that there is another SQL Server instance (not 2000, or 2005) running on the IP that you are connecting to. Try connecting via server or instance name if possible.
Kev
Only reason for this can be if you are trying to connect to higher version of SQL Server. Please check again if it is SQL Server 2005 or 2008 you are trying to connect.
Here is similar problem and solution for it at sql-server-performance site
edit:- also if you have installed some version of SQL Server 2008 it may also break Management Studio.
Right - to get to the bottom of this I would check the version from the command prompt, from the machine experiencing the problem:
sqlcmd -Q "SELECT ##VERSION" -S myserver\myInstance -U myUserName -P myPassword
This will give you the version of SQL Server you are connecting to. 'sqlcmd' will run against old and new versions of SQL Server.
You can use the same technique, with different SQL to identify which server you are really connecting to, etc.

Resources