cannot find sqlcmd in win server 2008 - windows-server-2008

i am using Windows Server 2008.Where i couldn't get the sqlcmd running using cmd:
It says: 'sqlcmd' is not recognised as an internal or external command, operable program or batch file

If you dont have SQL Server 2008 installed, then you will have to install SQL Server 2008 Feature Pack
Ie : http://www.microsoft.com/en-us/download/details.aspx?id=8824
Select the right version:
Microsoft SQL Server 2008 R2 Command Line Utilities
The SQLCMD utility allows users to connect to, send Transact-SQL batches from, and output rowset information from SQL Server 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008 instances. The bcp utility bulk copies data between an instance of Microsoft SQL Server 2008 R2 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files.
Note: This component requires both Windows Installer 4.5 and Microsoft SQL Server Native Client (which is another component available from this page).

Related

how to attach .mdf file to sql server 2008 EXPRESS

I have .mdf files created using SQL SERVER management studio in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so?
I tried this method :How to: Attach a Database File to SQL Server Express
but then it shows an error that the database cannot be created due to compatibility issues.
Msg 948: The database xyz cannot be opened because it is version 706.
This server supports version 655 and earlier. A downward path is not
supported..
....
This basically means your SQL versions don't match. For example, if you backup a database on SQL 2012, you can't restore it to 2008. In your case Version 706 is a database file from Sql Server 2012 and Version 663 is a database file from Sql Server 2008R2 (with some SP).
You can either install SQL Express 2012 to attach the MDF, or if you can't do that, you would have to script out your schema and data and create the DB from scratch.. Unfortunately there's no way to 'downgrade' and MDF back to an older version of SQL.
The message is very clear:
The database MDF file is version 706. Your server understands version 655 . Which means, despite to your claim to the contrary, that you are connected to a SQL Server 2008.
Install a SQL Server 2012, connect to it, and attach your database.
Please pay attention during the installation process to the instance name you choose and make sure you connect to that instance.
You can also check now what instances you have installed, look at what services you have on your system.
SELECT ##VERSION AS 'SQL Server Version'

SQL server version 655

what update i need to install for version 655 in vs studio 2010 for the sql server.
Can anyone tell me what i need on my computer when creating a database using sql on vs studio 2010? I need to use version 655 cos thats the version being used on Uni Computers
SQL Server 2008 (655) and SQL Server 2008 R2 (661) are not the same thing (though it is a common misconception - a lot of people think they're the same because Microsoft made a terrible, terrible, terrible naming decision, making 2008 R2 sound like a service pack).
You can't attach/restore a 2008 R2 database to a 2008 instance, period. Though there are several workarounds (that also apply for attaching 2012 -> 2008, 2008 -> 2005, 2008 R2 -> 2005, etc). You can either upgrade the engine you're trying to connect to up to 2008 R2, or you can extract the schema / data from the database using generate scripts wizard, import/export data wizard, SSIS, or 3rd party tools like Red Gate SQL Compare (for a full list of alternatives see this blog post).
This comes up extremely often, did you search for "sql server version 661 655"? I came up with a whole bunch of hits using this search term and some slight variations, all on this site and dba.SE:
Failure attaching SQL Server 2008 database to SQL Server 2005
Cannot attach 2008 R2 database to 2008 instance
Database restore error
Create Database in SQL Server 2012, Script and Use in 2008?
Cannot restore backup on SQL Server Express
How to automatically restore a SQL Server 2008 R2 backup file
Database "cannot be opened because it is version 661" when attaching .mdf file
Use database 661 version with SQL Server 2008
SQL Server: Attach incorrect version 661
https://dba.stackexchange.com/questions/21525/restoring-an-sql-server-2012-mdf-to-sql-server-2008
https://dba.stackexchange.com/questions/20588/restore-sql-server-2012-backup-to-a-sql-server-2008-database
If you are developing .NET based apps in visual studio 2010, then they will typically support all versions of Microsoft SQL Server. That does not mean you install SQL server INSIDE of visual studio, just that you can connect to a SQL Server instance running somewhere.
If you are asking "Where can I get a copy of SQL Server that my university is using?", that depends. For development, you can use a SQL Express installation on your local machine that matches the major release of SQL (2005, 2008, 2008R2, 2012), or you can request the university (or someone else) grant you access to an existing SQL instance.

SQL Server Management Studio 2008 connects to SQL 2012 localdb

is it possible to use SQL Server Management Studio 2008 to connect to instances of SQL 2012 localdb?
I have installed the 2012 Native Client, which contains the ODBC driver, but I still can't seem to use the SSMS 2008 to connect to my localdb instance.
I have no problem using the sqlcmd to connect to the localdb, so it is not the server problem.
Thank you
You could do it via named pipes this way:
1 - Get the address of a (localdb) instance by running the following command: "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SqlLocalDB.exe" info [InstanceName] (if its the default instance you're interested in, specify v11.0 as the [InstanceName] You can write it in CMD to text file with the command:
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SqlLocalDB.exe" info v11.0 > C:\db_details.txt
2 - Copy the "Instance pipe name" value, e.g. np:.\pipe\LOCALDB#1E0FF40B\tsql\query
3 - Paste the "Instance pipe name" value as the Server Name.
Install CU6 on system with SSMS 2008R2 as it contains some fixes related to compatibility issues with SQL Server 2012.
If you can see the 2012 server in your SSMS 2008R2 than you have connected it.
Open a new query window and execute the following code:
select ##version
try this :
ip Address\sqlserver2012 in the server name.
then set the Authentication method = SQL Server Authentication and provide thw login and password fields.

Converting SQL Server database to local C# database

I have created program that uses SQL Server database to store data. After a while (and lots of stored data) I have realized I don't need database on the server, local database running without server could do the job.
Now I need some advice how to export, convert or whatever, SQL Server database to local (sdf) database? I'm using VS 2010 and SQL Server 2008, I also have SQL Server Management Studio.
Check out the SQL Server to SQL Server Compact Edition Copy Tool available on CodeProject in C# source code:
Should do just what you need: copy data from SQL Server to a SQL Server Compact Edition .sdf file.
Use the Export database tool? If you are using MS Windows OS then you can access is through the JET interface.
Use my Export2sqlce.exe command line utility: http://erikej.blogspot.com/2010/02/how-to-use-exportsqlce-to-migrate-from.html

Can I use PowerShell with SQL Server 2005?

I know SQL Server 2008 has exposed some features to PowerShell as snapins. Now I want to know whether I can use PowerShell with SQL Server 2005? I guess the answer is NO, right? Thanks.
Yes -- You can use PowerShell with SQL Server 2005. The SQL Server 2008 minishell, sqlps.exe, which ships with SQL Server 2008 works against 2005 and even 2000 servers.
To get sqlps you'll need to either install SQL Server 2008 Management Studio or sqlps is available as a separate download as part of the SQL Server 2008 Feature Pack
In addition you can write PowerShell code directly using SQL Server Management Objects (SMO). SMO is the underlying classes used in SSMS and sqlps and was first introduced in SQL Server 2005. Like sqlps, SMO will work against SQL Server 2000.
The CodePlex project I coordinate, SQL Server PowerShell Extensions, provides over 130 functions and uses SMO and PowerShell that work with 2000 through 2008 R2 versions of SQL Server.