SQL Server Temp Linked Server? - sql-server-2005

Can anyone recommend a cool trick to create a linked server for some temporary work (selects with joins) and then destroy it after it's done? There are two different physical servers (one is MSSQL 2005 and one is SQL Server 2008) and I need to do some querying, after that the 2005 server will be switched out and I will have to do the same thing with a different 2005 server.
All thoughts appreciated - thanks!

Should be simple enough to script, have a look at the following stored procedures for creating and dropping linked servers
sp_addlinkedserver
sp_dropserver

Related

backing up sql database from microsoft sql server

i just want to ask if how can i backup my database from sql server 2005 using sql server management studio express? i want a backup it using sql file (.sql and not .bak or .mdf) from creating database (if not exist), tables and even the records on the table..thanks in advance :)
This is not possible with one command. You can script single objects, but I'm not aware of a way to do this in SSMS. We use SQL Compare from redgate here - it's pretty great.
You can try powershell.
Docs here.

Linking SQL Server 2000 and SQL Server 2008, is this possible?

I am writing stored procs for a new system in SQL Server 2008 but I need to also update data in an older db - SQL Server 2000. I have searched but haven't found any solution to this. Is it possible? What are my choices?
Thank you!!
If you mean connect to and query against a SQL Server 2000 database, then yes, this is possible through the use of linked servers assuming that the two database servers are able to communicate with each other on the same network.
See Linked Servers for more.
This has been asked and answered in another thread, but here's a great link to get you on your way:
http://msdn.microsoft.com/en-us/library/ms188279.aspx
The concept you're looking for is called a "linked server", which allows SQL Server to send SQL commands to a remote server.

SQL - SSMS2005 - How do I copy a database diagram to another database?

Is there a simple method for copying a database diagram from one database server to another?
I have a diagram on a development server that needs to be moved to the production server.
Thanks
(Sql server 2005, SSMS2005 Express)
you can try codeproject Script SQL Server 2005 diagrams to a file
In SQL Server 2005, database diagrams are stored in the sysdiagrams table. You should be able to use the Import/Export wizard to copy the diagram data from one server to another. I ran a quick test and was able to copy a diagram from one database to another of the same server using the wizard. This was tested on a SQL Server 2005 Standard installation.

MySQL: Selecting data from MS SQL Server

How do I select data from a MS SQL Server from MySQL? We have a system of linked server in SQL Server. I have also heard that you can do a linked server to Mysql from sql server. But I want to know the reverse.
The mssql server is what we use mainly for production. So one main reason we'd want to do this is simply to get the exact mssql server's time.
I dont think it will be possible, reverse is possible with only .Net scripting support. However, you may setup a time synchronization mechanism between two servers.

Restore SQL Server 2008 DB *to* SQL Server 2005

Got myself in a bit of a pickle here ... working on a CMS project, under the assumption that sql server 2008 was greenlighted as the db of choice. Well it wasn't, we now have to backport all of our content out SQL Server 2008 and into SQL Server 2005.
A simple backup/restore procedure yields: "RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)".
Unfortunately, exporting the data to an excel spreadsheet yields multiple OLE errors which I believe is actually a problem in the db of the cms.
Does anyone out there have other approaches they would like to recommend for this task? Thanks in advance
Use RedGate:
tool for comparing and deploying SQL Server database contents.
You can work with live databases, backups, or SQL scripts in source control. Damaged or missing data can be restored to a single row, without the need for a full database recovery.
SQL Data Compare helps you compare and deploy changes quickly, simply, and with zero errors...
There is no way to do this by default. You can generate scripts for 2008 database on 2008 server and then execute these scripts on 2005 version. Note that you’ll have to manually review scripts and remove all parts that are unique to 2008 version.
Another way is to use third party tools such as Red Gate or ApexSQL Diff (move schema) and ApexSQL Data Diff (move data).
Use the Generate SCripts to create the database and schema and ensure you target SQL Server 2005 and script data.
Rather than do a backup and restore you might try using SQL 2005's Import/Export Data wizard.
http://support.microsoft.com/default.aspx?scid=kb;en-us;314546
http://msdn.microsoft.com/en-us/library/ms140052(SQL.90).aspx
I've just hit the same problem and here is how I worked around it.
The problem was to copy a database from an operational SQL Server 2008 database to a new SQL Server 2005 database.
I scripted the database using Management Studio on the 2008 server. I only scripted the database design, not the data. I should add also that the DB only has tables and indexes, so I haven't tried this with any cleverer objects although I can't think why they wouldn't work.
On the 2005 server I created a new database by hand and then ran the script to set up all the tables and indexes.
The in Management Studio back on the 2008 server I used the Export Data wizard to export the data from the 2008 server to the 2005 server. It's currently running and seems quite happy moving the data.
Once all the data is across I'll have a couple of small things left to do - create the users and set-up the security in the 2005 DB, but all-in-all it doesn't look like a bad way of doing it. It's not quite point-and-click but it's not too strenuous.
So it seems that the Copy Database wizard won't work (I think because the package ultimately runs on the 2005 server and 2005 Management Studio can't talk to 2008) but the Export Data wizard is quite happy moving data ... as long as the DB already exists on the target server.
Hope that's useful.
It's not possible to restore to previous versions in SQL Server
Is there no SQL 2005 backup around? Otherwise you really are limited to export the entire database in 2008, and re-import back into 2005, or the Import/Export wizard in 2008
Or rely on 3rd party tools. e.g. Red Gate Data Compare is able to sync. the DATA between 2 servers/databases
I only use mysql but can you export your data into sql statments, and then import then into sql2005? Just a thought..
I faced a similar problem (sql 2005 to sql 2000), and found that I happened to have a blank database at the older version. I used bcp.exe to copy all the data.
check this link click here
You can create the database script in sql server 2008 and you can use it sql server 2005 and lower version....