How to restore SQL SERVER 2008 database in SQL Server 2005 - sql

I have created a database in SQL Server 2008, My database have more then 100 tables, but when i am trying to restore the database in SQL Server 2005, then its not allowing me to restore.
Does any one have idea how to do that, I tried the same using generate script but it doesnot work for me.
Thanks in advance.
Kamal Kant Pansari

Use the scripting wizard in SQL Server 2008 to script data as well as schemas into SQL Server 2005 compatibility mode.
Run "Generate SQL Server Scripts" wizard in SQL Server Management Studio (once Object Explorer is connected to the appropriate instance) by right clicking on database and selecting "Tasks –> Generate Scripts."
Click "Script all objects in selected database" & then click "Next."
Change script options: Specifically, set "Script for Server Version" to "SQL Server 2005" and set "Script Data" to "True". (SQL Server 2000 is also supported.) If you are putting the database on a new instance for the first time, make sure the "Script Database Create" option is set to "True." Click "Next" when you are happy with options.
Finish the wizard.

The conversation in this thread may be of interest: http://www.sqlservercentral.com/Forums/Topic584539-357-1.aspx

Related

SSMS v18.00 in MSSQL 2016

I have got MSSQL 2016 (SP2-CU11) (KB4527378) with SSMS v18.00. In this version SSMS I not able to create local DB SSISDB. SSMS offered me DB in AZURE DB only. If I use SSMS 17.9, all is OK and I create local SSISDB. Am I able to disable this functionality in SSMS 18.00?
Solution is easy. In wizard after Create Catalog you have to enable "Enable CLR Integration", fill password and press enter. You must not press button "Create SSIS IR"

Microsoft SQL Server 2005 backup the database in *.sql

I work in a small company which is running M/S SQL Server 2005
Now our head office is asking me to give the whole database backup with the table schema in a single file of *.sql
please help me to backup my database in a *.sql including the table schema.
Thanks in advance.
Use SQL Server Management Studio
right click on your database and choose Generate scripts... and hit Next
choose Script entire database and all database objects and hit Next
choose Save to file and enter a path and a file name for your future sql script file. On the same screen choose Advanced and change the Types of data to script property value from Schema only to Schema and data. Hit OK. Hit Next.
and hit Next again.
You can download, install, and use SQL Server Management Studio that comes free with Microsoft® SQL Server® 2012 Express for that
I would go out and download Microsoft SQL Server Management Studio Express.
http://www.microsoft.com/en-us/download/details.aspx?id=8961
It is free. You will be able to connect to the database, drill down into Databases, right click and under Tasks, pick Backup Database. Make sure you pick full...CHoose Disk as the place you want to write it to and Execute...Look thru your options as well...
Hope this helps!
I’d go with the method peterm suggested but note that this also has flaws. Problem is that SSMS doesn’t order the scripts in correct execution order.
For example, it might happen that DDL for stored procedure P is before DDL for table T that is used in P.
All you need to do is to review your script and make sure there are no such cases. If there are you can try fixing this yourself or using some third party tool to generate script that is ordered correctly.

Cant edit schema or data from sql server management studio

I have connected to my SQL azure server using SQL Server 2012 Management Studio and I cannot edit any of my table's schema or the data in it. When I right click on the table the options are missing. Am I doing something wrong?
Not that I am using SSMS 2012, but in 2008 R2 is generally the same. There is no GUI for neither table designer, nor "Edit top 200 records". You have to begin diving into the DDL and DML for SQL Server and give up GUIs. One way you could use GUI to some extend, especially for DDL is to use the portal provided Windows Azure SQL Database manager. You can find a link to it when you go to your database from either the new or the old portal (Manage). Other way is to use some third party tool, which I am not aware of.
Here is the link to that manager from the new portal:
Another option some people may find helpful, if you have and use Visual Studio then you can link to the server in ServerManager, connect to the database, and then design and edit data directly.
My 2008 R2 version of SSMS had the same problem. I downloaded 2016 CTP3 SSMS which has Azure support and everything is normal for the Azure Databases.
https://msdn.microsoft.com/en-us/library/mt238290.aspx
I did lose my connection history information so beware.

How do I back up a database to a .bak file?

I have a website I've created in Visual Studio 2008 and I need to take it live. How can I backup the database file to a .bak so I can hand it over to the hosting company to place on the server?
From a SQL prompt:
BACKUP DATABASE MyDatabase TO DISK='E:\MyDatabase.bak'
Go to Microsoft Server Management Studio and right click on your database name. Go to "Tasks" -> "Back Up..."
Then assign your properties, ensure that "Backup Type" is full.
Then at the right there is a button "Add" press that and set your filename, ensure that you place the extension .bak at the end of the file name.
Finally hit ok and wait for the backup to complete.
MSDN also has an article that explains this http://msdn.microsoft.com/en-us/library/ms187510.aspx
In ssms right click on the database, go to tasks, click back up. should be self explanatory from there.
You don't need a backup to do so (I assume you are using the AttachDbFilename model that Visual Studio uses by default). Just send them the mdf and tell them to attach it to their SQL server instance.
I assume you use SQL Server. This links will guide you:
How to: Back Up a Database (SQL Server Management Studio):
SQL Server 2008
SQL Server 2005

Is there a way to import SQL script into MDF database in Visual Studio?

I created a "Service-Based Database" (.MDF) in Visual Studio and now want to import a SQL script into it, but cannot find any way to do this:
I can right-click on the .mdf file and choose "New Query" but there is no place to copy in query text as in Management Studio
Does the Visual Studio 2008 Database Explorer have a way to enter or import SQL query text?
When you choose "New Query", the default behavior is to open the Query Editor. So you have to close the Add Table. After that, you should see a window with four panes - Diagram, Criteria, SQL and Result pane. You should be able to put your script to SQL pane and run from it. The Studio may complain about being unable to parse the script, just ignore it and hit ok, the script should run.
If you cannot see these panes, ensure you have "Query Designer" toolbar enabled and "SQL pane" button pushed.
However, I would recommend installing SQL Management Studio, there is a free express version available.
Why don't you just attach the database directly to your SQL Server (or SQLExpress) and then copy the database objects. The detach from the sql server again.