Click here to Skip to main content
15,922,533 members
Home / Discussions / Database
   

Database

 
Generalfiltering dataset and pu the result in another datatable. Pin
Aslesh20-Nov-08 12:03
Aslesh20-Nov-08 12:03 
GeneralRe: filtering dataset and pu the result in another datatable. Pin
Ashfield20-Nov-08 20:01
Ashfield20-Nov-08 20:01 
GeneralCross-post Pin
Wendelius21-Nov-08 22:42
mentorWendelius21-Nov-08 22:42 
Questioncopying a record from one database to another database in sql server 2000 using c# Pin
Berlus20-Nov-08 11:39
Berlus20-Nov-08 11:39 
Questionconvert MS SQL DB 2008 to 2005 Pin
Aslesh20-Nov-08 9:36
Aslesh20-Nov-08 9:36 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Wendelius20-Nov-08 9:49
mentorWendelius20-Nov-08 9:49 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Edin Jen Raj15-Jun-10 2:05
Edin Jen Raj15-Jun-10 2:05 
AnswerRe: convert MS SQL DB 2008 to 2005 Pin
Edin Jen Raj15-Jun-10 2:06
Edin Jen Raj15-Jun-10 2:06 
Restore a SQL Server 2008 Database into SQL Server 2005


If you've tried to back up a database in SQL Server 2008 and then restore it into SQL Server 2005, you know that the database backups are not backward compatible. However, with SQL Server 2008 Management Studio, you can script data and schemas in SQL Server 2005 mode. This 10-Minute Solution takes you through the steps to back up the Northwind database on SQL Server 2008 and restore it to SQL Server 2005.
The Problem:
Transferring databases from SQL Server 2008 to SQL Server 2005 is not possible with standard backup and restore facilities.
The Solution:
Leverage the scripting wizard in SQL Server 2008 to script data as well as schemas in SQL Server 2005 compatibility mode.
Using the "Generate SQL Server Scripts" Wizard
The Northwind database is no longer shipped as part of the SQL Server installation, but you can download it from go.microsoft.com. The data is scripted as INSERT statements.
To create the scripts, you have to run the "Generate SQL Server Scripts" wizard, which you can run within SQL Server Management Studio (once Object Explorer is connected to the appropriate instance) by right clicking on the database and selecting "Tasks –> Generate Scripts."

Figure 1 shows the initial dialog to the wizard. Click "Next" and complete the following steps in the wizard to back up the Northwind database on SQL Server 2008 and restore it to SQL Server 2005
Figure 1. Initial Dialog to Generate SQL Server Scripts Wizard: To create your scripts, you have to run the "Generate scripts" wizard.
Click "Script all objects in the selected database" (see Figure 2), and then click "Next."
Figure 2. Select Database Dialog: Click the "Script all objects in the selected database" option.


Amend the script options: Specifically, set "Script for Server Version" to "SQL Server 2005" and set "Script Data" to "True" (see Figure 3). (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 the options.

Figure 3. Choose Script Options Dialog: Set the "Script Data" option to "True."
Select "Script to file," select the file name, and choose "Single file" (see Figure 4). Click "Next" for a summary (see Figure 5).
Figure 4. Output Option Dialog: Select "Script to file," select the file name, and choose "Single file."
Figure 5. Script Wizard Summary: Review your selections for the wizard.

Now click on "Finish" to get progress messages while the script runs and completes (see Figure 6)

Figure 6. Generate Script Progress Dialog: Click "Finish" and you will get progress messages.

If the generation process fails, then you can use the "Report" option to see why.
When the scripting is completed, look for the following lines:

CREATE DATABASE [Northwind] ON PRIMARY
(NAME = N'Northwind', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\northwnd.mdf' ,
SIZE = 3328KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON

(NAME = N'Northwind_log', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\northwnd.ldf' ,
SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
You will need to amend the paths to a valid path for the computer on which you are running. You also will need to comment out the following lines like this:

--EXEC sys.sp_db_vardecimal_storage_format N'Northwind', N'ON'
--GO
Once you have made these changes, you can run the script in SQL Server 2005 Management Studio to recreate the database in your development environment. You can now test data against SQL Server 2008 and SQL Server 2005.
The Inevitable Limitations
Of course, this technique is not without its limitations. Here are a few to bear in mind:
The data is insecure, as it is in clear readable text. So if you are using real data, you should delete the file created once you have loaded it into SQL Server 2005. You can regenerate the file from the SQL 2008 backup, if necessary.
If you have a database with a large amount of data, the script file, of course, will be huge.
SQL Server 2008 specifics in the source database will not be migrated.
QuestionCOUNT PROBLEM Pin
member2720-Nov-08 1:40
member2720-Nov-08 1:40 
AnswerRe: COUNT PROBLEM Pin
RGTuffin20-Nov-08 2:54
RGTuffin20-Nov-08 2:54 
GeneralRe: COUNT PROBLEM Pin
member2720-Nov-08 17:15
member2720-Nov-08 17:15 
QuestionMatches from 2 tables Pin
highjo20-Nov-08 0:54
highjo20-Nov-08 0:54 
AnswerRe: Matches from 2 tables Pin
RGTuffin20-Nov-08 3:36
RGTuffin20-Nov-08 3:36 
GeneralRe: Matches from 2 tables Pin
highjo20-Nov-08 4:13
highjo20-Nov-08 4:13 
AnswerRe: Matches from 2 tables Pin
Wendelius20-Nov-08 7:32
mentorWendelius20-Nov-08 7:32 
Questionselect max(string) Pin
Zeyad Jalil19-Nov-08 19:49
professionalZeyad Jalil19-Nov-08 19:49 
AnswerRe: select max(string) Pin
Xandip19-Nov-08 19:54
Xandip19-Nov-08 19:54 
GeneralRe: select max(string) Pin
Zeyad Jalil19-Nov-08 22:17
professionalZeyad Jalil19-Nov-08 22:17 
GeneralRe: select max(string) Pin
Ashfield19-Nov-08 22:27
Ashfield19-Nov-08 22:27 
AnswerRe: select max(string) Pin
Syed Mehroz Alam19-Nov-08 19:58
Syed Mehroz Alam19-Nov-08 19:58 
GeneralRe: select max(string) Pin
Zeyad Jalil19-Nov-08 22:17
professionalZeyad Jalil19-Nov-08 22:17 
AnswerRe: select max(string) Pin
Paddy Boyd20-Nov-08 0:00
Paddy Boyd20-Nov-08 0:00 
AnswerRe: select max(string) Pin
RGTuffin20-Nov-08 0:46
RGTuffin20-Nov-08 0:46 
AnswerRe: select max(string) Pin
Wendelius20-Nov-08 7:00
mentorWendelius20-Nov-08 7:00 
QuestionAdd Identity Key behaviour to existing primary key column. Pin
Xandip19-Nov-08 19:34
Xandip19-Nov-08 19:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.