<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Linglom.com &#187; MS SQL Server</title> <atom:link href="http://www.linglom.com/category/windows/ms-sql-server/feed/" rel="self" type="application/rss+xml" /><link>http://www.linglom.com</link> <description>Source of IT knowledge</description> <lastBuildDate>Wed, 07 Dec 2011 14:03:35 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>How to Install Sample Databases (Northwind and Pubs) in SQL Server 2008 Express</title><link>http://www.linglom.com/2011/12/07/how-to-install-sample-databases-northwind-and-pubs-in-sql-server-2008-express/</link> <comments>http://www.linglom.com/2011/12/07/how-to-install-sample-databases-northwind-and-pubs-in-sql-server-2008-express/#comments</comments> <pubDate>Wed, 07 Dec 2011 14:03:35 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[Sample Database]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=1381</guid> <description><![CDATA[The databases, such Northwind and Pubs, are sample databases which are used for testing and developing on SQL Server. They are widely used in many sample source code and referenced by many tutorials. So if you are a developer or want to learn about SQL on SQL Server, these databases are needed to be installed [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/' rel='bookmark' title='Enable Remote Connection on SQL Server 2008 Express'>Enable Remote Connection on SQL Server 2008 Express</a> <small>Introduction Last time, I wrote an article show how to...</small></li><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li></ol>]]></description> <content:encoded><![CDATA[<p>The databases, such <strong>Northwind</strong> and <strong>Pubs</strong>, are sample databases which are used for testing and developing on SQL Server. They are widely used in many sample source code and referenced by many tutorials. So if you are a developer or want to learn about SQL on SQL Server, these databases are needed to be installed on your development PC.</p><p><span
id="more-1381"></span></p><p>This article shows how to install Northwind and Pubs databases on Microsoft SQL Server 2008 Express.<br
/></p><h3>Step-by-step</h3><ol><li>Browse to <a
href="http://archive.msdn.microsoft.com/northwind/Release/ProjectReleases.aspx?ReleaseId=1401" target="_blank" rel=nofollow">SQL Server 2000 Sample Databases</a> and click on <strong>SQL2000.Sample.Databases.(Northwind,pubs).zip</strong> to download the Northwind and Pubs databases. Once you clicked the file, there will be a pop-up displays license of this file. Click <strong>I Agree</strong> to download the file.<br
/> <em><strong>Note:</strong></em> This file contains sample databases that can be used on SQL Server 2000/2005/2008.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_1.png" width="200" height="162" alt="Download SQL Server 2000 Sample Databases" title="Download SQL Server 2000 Sample Databases"  /></a></li><li>Extract the zipped file, you will see files as the figure below. There are two methods to install these sample databases on SQL Server. The first method, run query on the SQL Server using <strong>instnwnd.sql</strong> and <strong>instpubs.sql</strong> for Northwind and Pubs databases respectively. The second method, attach database on SQL Server using <strong>NORTHWND.LDF</strong> and <strong>NORTHWND.MDF</strong> for Northwind database and <strong>PUBS.MDF</strong> and <strong>PUBS_LOG.MDF</strong> for Pubs database. On this article, I will show how to install Northwind and Pubs databases using the second method.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_2.png" width="200" height="141" alt="Sample Database Files" title="Sample Database Files"  /></a></li><li>Open Microsoft SQL Server Management Studio and connect to your SQL Server.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_3.png" width="200" height="152" alt="Connect to SQL Server" title="Connect to SQL Server"  /></a></li><li>Once the connection has been established, right-click on <strong>Databases</strong> and select <strong>Attach</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_4.png" width="200" height="191" alt="Attach Databases" title="Attach Databases"  /></a></li><li>On <strong>Attach Databases</strong>, click <strong>Add</strong> in Databases to attach section.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_5.png" width="200" height="180" alt="Add Databases to Attach" title="Add Databases to Attach"  /></a></li><li>On <strong>Locate Database File</strong>, browse to the folder where you extracted the downloaded file in step 2. Select a database file that you want to attach. I select <strong>NORTHWND.MDF</strong> which refers to Northwind database and click <strong>OK</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_6.png" width="200" height="280" alt="Locate Database File" title="Locate Database File"  /></a></li><li>You will see detail of Northwind database. The <strong>NORTHWND.LDF</strong> is automatically added in the details on section below (&#8220;Northwind&#8221; database details).<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/7.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_7.png" width="200" height="180" alt="Select Northwind database to attach" title="Select Northwind database to attach"  /></a></li><li>Repeat step 5 and 6 for Pubs database by attach <strong>PUBS.MDF</strong> file if you want to attach more than one database at the time. After you finish selecting databases that you want to attach, click <strong>OK</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/8.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_8.png" width="200" height="180" alt="Select Pubs database to attach" title="Select Pubs database to attach"  /></a></li><li>If there is no error, you will see the sample databases (Northwind and Pubs) list on the SQL Server as the figure below. Now you can use these sample databases as you want.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/9.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Install-Sample-Databases/_9.png" width="200" height="169" alt="Attached Sample Database" title="Attached Sample Database"  /></a></li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/' rel='bookmark' title='Enable Remote Connection on SQL Server 2008 Express'>Enable Remote Connection on SQL Server 2008 Express</a> <small>Introduction Last time, I wrote an article show how to...</small></li><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2011/12/07/how-to-install-sample-databases-northwind-and-pubs-in-sql-server-2008-express/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>[Solved] Error 29506 when installing Microsoft SQL Server Manament Studio Express on Windows Vista or Windows Seven</title><link>http://www.linglom.com/2011/12/03/solved-error-29506-when-installing-microsoft-sql-server-manament-studio-express-on-windows-vista-or-windows-seven/</link> <comments>http://www.linglom.com/2011/12/03/solved-error-29506-when-installing-microsoft-sql-server-manament-studio-express-on-windows-vista-or-windows-seven/#comments</comments> <pubDate>Sat, 03 Dec 2011 14:54:47 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=1368</guid> <description><![CDATA[Note: This article is applied on installing Microsoft SQL Server Management Studio Express which is used for manage Microsoft SQL Server 2005 Express only. When you are installing Microsoft SQL Server Management Studio Express on Windows Vista or Windows 7, you may receive this error message: The installer has encountered an unexpected error installing this [...]
No related posts.]]></description> <content:encoded><![CDATA[<p><em><strong>Note: </strong></em>This article is applied on installing Microsoft SQL Server Management Studio Express which is used for manage Microsoft SQL Server 2005 Express only.</p><p><span
id="more-1368"></span></p><p>When you are installing <a
href="http://www.microsoft.com/download/en/details.aspx?id=8961" target="_blank" rel="nofollow">Microsoft SQL Server Management Studio Express</a> on Windows Vista or Windows 7, you may receive this error message:</p><p><em><strong>The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 29506.</strong></em><br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_1.png" width="200" height="152" alt="Error 29506" title="Error 29506"  /></a></p><p>This error message relates with permission issue (UAC) on Windows Vista and Windows 7. To solve this problem, you have to re-run the installer again using elevated command prompt by run the command prompt as administrator and execute the installer in there. If you are using 64-bit Windows, you should use the command prompt at C:\Windows\SysWOW64\cmd.exe instead. Otherwise, you can use the command prompt at C:\Windows\System32\cmd.exe. You will see the step-by-step guide to use elevated command prompt to execute the installer file on the section below.</p><p>The other solution, you can disable UAC on Windows but I don&#8217;t recommend it since it will lower your security system.</p><p></p><h3>Step-by-step</h3><ol><li>Run elevated command prompt by right-click on Command Prompt in <strong>Start</strong> -> <strong>All Programs</strong> -> <strong>Accessories</strong> -> <strong>Command Prompt</strong> and select <strong>Run as administrator</strong>.<br
/> <em><strong>Note:</strong></em> This step is for 32-bit Windows. If you are using 64-bit Windows, see the next step.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_2.png" width="200" height="167" alt="Open Command Prompt as Administrator" title="Open Command Prompt as Administrator"  /></a></li><li>If you are using 64-bit Windows, you have to run the command prompt in C:\Windows\SysWOW64. Right-click on cmd.exe and select <strong>Run as administrator</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_3.png" width="200" height="150" alt="Open Command Prompt as Administrator For 64-bit Windows" title="Open Command Prompt as Administrator For 64-bit Windows"  /></a></li><li>On <strong>User Account Control</strong>, click <strong>Yes</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_4.png" width="200" height="106" alt="User Account Control" title="User Account Control"  /></a></li><li>On Command Prompt (both 32-bit and 64-bit Windows), change path to directory where the installer file is and execute the file. By default, the file name for 32-bit version is <strong>SQLServer2005_SSMSEE.msi</strong> and 64-bit version is <strong>SQLServer2005_SSMSEE_x64.msi</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_5.png" width="200" height="101" alt="Execute the installer file" title="Execute the installer file"  /></a></li><li>On Setup Wizard, follow the instruction as usual. There won&#8217;t be the error message this time.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQL-Server-Management-Studio-Express/Error-29506/_6.png" width="200" height="152" alt="Microsoft SQL Server Management Studio Express Setup" title="Microsoft SQL Server Management Studio Express Setup"  /></a></li></ol><p>No related posts.</p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2011/12/03/solved-error-29506-when-installing-microsoft-sql-server-manament-studio-express-on-windows-vista-or-windows-seven/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>[Solved] ActiveX component can&#8217;t create object: &#8216;SQLDMO.SQLServer&#8217; on SQL Server 2008</title><link>http://www.linglom.com/2010/01/13/solved-activex-component-cant-create-object-sqldmo-sqlserver-on-sql-server-2008/</link> <comments>http://www.linglom.com/2010/01/13/solved-activex-component-cant-create-object-sqldmo-sqlserver-on-sql-server-2008/#comments</comments> <pubDate>Wed, 13 Jan 2010 04:22:38 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2008]]></category> <category><![CDATA[SQL-DMO]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=1129</guid> <description><![CDATA[Problem If you execute a vb script which use SQL-DMO on SQL Server 2008, you will notice that the script doesn&#8217;t work at all. You will see the error message as similar to this one when you execute the vb script: Error: ActiveX component can&#8217;t create object: &#8216;SQLDMO.SQLServer&#8217; Code: 800A01AD Source: Microsoft VBScript runtime error [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2009/06/13/solved-failed-to-create-sql-login-for-group-on-database-server/' rel='bookmark' title='[Solved] Failed to Create SQL Login for Group On Database Server'>[Solved] Failed to Create SQL Login for Group On Database Server</a> <small>Problem You&#8217;re configuring BizTalk Server 2006 which BizTalk databases are...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Problem</h3><p>If you execute a vb script which use SQL-DMO on SQL Server 2008, you will notice that the script doesn&#8217;t work at all.</p><p><span
id="more-1129"></span></p><p>You will see the error message as similar to this one when you execute the vb script:</p><blockquote><p>Error: ActiveX component can&#8217;t create object: &#8216;SQLDMO.SQLServer&#8217;<br
/> Code: 800A01AD<br
/> Source: Microsoft VBScript runtime error</p></blockquote><p><a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_1.png" width="250" height="97" alt="ActiveX component can't create object: 'SQLDMO.SQLServer'" title="ActiveX component can't create object: 'SQLDMO.SQLServer'"  /></a></p><h3>Cause</h3><p>This is because SQLDMO is deprecated since SQL Server 2005. But SQLDMO is installed on SQL Server 2005 by default so you can run a vb script which uses SQLDMO without any error on SQL Server 2005. On SQL Server 2008, SQLDMO is not installed by default . If you want to use SQLDMO, you have to install it manually.</p><p></p><h3>Solution</h3><p>To use SQL-DMO on SQL Server 2008, you need to download and install <strong>Microsoft SQL Server 2005 Backward Compatibility Components</strong> to solve the problem. You can go to <a
href="http://www.microsoft.com/downloads" target="_blank" rel="nofollow">Microsoft Download Center</a> and search for &#8220;Microsoft SQL Server 2008 Feature Pack&#8221; and sort by Release Date to find the latest version. Or you can download at <a
href="http://forum.linglom.com/index.php?topic=692" target="_blank">Linglom&#8217;s Download Page</a>.</p><h3>Step-by-step</h3><ol><li>Download <strong>Microsoft SQL Server 2005 Backward Compatibility Components</strong>. Next, execute the setup file.</li><li>On <strong>Welcome to the Install Wizard for Microsoft SQL Server 2005 Backward compatibility Setup</strong>, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_2.png" width="250" height="188" alt="Microsoft SQL Server 2005 Backward compatibility Setup" title="Microsoft SQL Server 2005 Backward compatibility Setup"  /></a></li><li>On <strong>License Agreement</strong>, select &#8216;<strong>I accept the terms in the license agreement</strong>&#8216;. Then, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_3.png" width="250" height="188" alt="License Agreement" title="License Agreement"  /></a></li><li>On <strong>Registration Information</strong>, enter your personal information. Then, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_4.png" width="250" height="188" alt="Registration Information" title="Registration Information"  /></a></li><li>On <strong>Feature Selection</strong>, ensure that <strong>SQL Distributed Management Objects</strong> is selected. Then, click <strong>Next</strong>.<br
/> <em><strong>Note:</strong></em> SQL-DMO is the feature that is require to run a vb script that uses DMO.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_5.png" width="250" height="188" alt="Feature Selection - SQL Distributed Management Objects (SQL-DMO)" title="Feature Selection - SQL Distributed Management Objects (SQL-DMO)"  /></a></li><li>On <strong>Ready to Install the Program</strong>, click <strong>Install</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_6.png" width="250" height="188" alt="Ready to Install the Program" title="Ready to Install the Program"  /></a></li><li>Installing Microsoft SQL Server 2005 Backward compatibility.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/7.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_7.png" width="250" height="188" alt="Installing Microsoft SQL Server 2005 Backward compatibility" title="Installing Microsoft SQL Server 2005 Backward compatibility"  /></a></li><li>On <strong>Completing the Microsoft SQL Server 2005 Backward compatibility Setup</strong>, click <strong>Finish</strong>. Now try to run vb script again, the problem should be gone!<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/8.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/SQLDMO.SQLServer-on-SQL-2008/_8.png" width="250" height="188" alt="Completing the Microsoft SQL Server 2005 Backward compatibility Setup" title="Completing the Microsoft SQL Server 2005 Backward compatibility Setup"  /></a></li></ol><h3>Reference</h3><p><a
href="http://blogs.msdn.com/dtjones/archive/2008/08/28/where-the-heck-is-dmo.aspx" target="_blank" rel="nofollow">Where the Heck is DMO?</a></p><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2009/06/13/solved-failed-to-create-sql-login-for-group-on-database-server/' rel='bookmark' title='[Solved] Failed to Create SQL Login for Group On Database Server'>[Solved] Failed to Create SQL Login for Group On Database Server</a> <small>Problem You&#8217;re configuring BizTalk Server 2006 which BizTalk databases are...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2010/01/13/solved-activex-component-cant-create-object-sqldmo-sqlserver-on-sql-server-2008/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard</title><link>http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/</link> <comments>http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/#comments</comments> <pubDate>Mon, 17 Aug 2009 08:55:06 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <category><![CDATA[SQL Server 2008]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=986</guid> <description><![CDATA[Export Data Wizard On Part 1: Introduction, I mentioned about error messages when you try to restore a database from SQL Server 2008 to SQL Server 2005. You can see the first solution at Part 2: Generate SQL Server Scripts Wizard. Now let&#8217;s see the second solution to solve the problems. On this post, you [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Export Data Wizard</h3><p>On <a
href="http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/">Part 1: Introduction</a>, I mentioned about error messages when you try to restore a database from SQL Server 2008 to SQL Server 2005. You can see the first solution at <a
href="http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/">Part 2: Generate SQL Server Scripts Wizard</a>. Now let&#8217;s see the second solution to solve the problems.</p><p><span
id="more-986"></span></p><p>On this post, you see how to export tables on <strong>&#8216;Northwind&#8217;</strong> database from SQL Server 2008 to SQL Server 2005 using export data wizard.</p><p></p><h3>Step-by-step</h3><ol><li>On <strong>Microsoft SQL Server Management Studio</strong>, connects to SQL Server 2008. Right-click on the database that you want to export data -> select <strong>Tasks</strong> -> <strong>Export Data</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_1.png" width="200" height="146" alt="Export Data" title="Export Data"  /></a></li><li>On <strong>Welcome to SQL Server Import and Export Wizard</strong>, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_2.png" width="200" height="204" alt="Welcome to SQL Server Import and Export Wizard" title="Welcome to SQL Server Import and Export Wizard"  /></a></li><li>On <strong>Choose a Data Source</strong>, select the source from which to copy data. Set <strong>Data source</strong> to <strong>SQL Server Native Client 10.0</strong>. Verify that <strong>Server name</strong> is the source of SQL Server 2008 that you want and select <strong>Database</strong> as <strong>&#8216;Northwind&#8217;</strong>. Click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_3.png" width="200" height="204" alt="Choose a Data Source" title="Choose a Data Source"  /></a></li><li>On <strong>Choose a Destination</strong>, specify where to copy data to. Set Destination to <strong>SQL Server Native Client 10.0</strong>. Type the <strong>Server name</strong> to the destination of SQL Server 2005 that you want. You can also click <strong>Refresh</strong> to verify if you can connect to the specify server name. Currently, I don&#8217;t have <strong>&#8216;Northwind&#8217;</strong> database on SQL Server 2005 so I will create a new one, click <strong>New</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_4.png" width="200" height="204" alt="Choose a Destination" title="Choose a Destination"  /></a></li><li>On <strong>Create Database</strong>, type name as <strong>&#8216;Northwind&#8217;</strong> and click <strong>OK</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_5.png" width="200" height="194" alt="Create Database" title="Create Database"  /></a></li><li>Back to <strong>Choose a Destination</strong>, I have created <strong>&#8216;Northwind&#8217;</strong> database so select it as <strong>Database</strong>. Click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_6.png" width="200" height="204" alt="Choose a Destination" title="Choose a Destination"  /></a></li><li>On <strong>Specify Table Copy or Query</strong>, select <strong>Copy data from one or more tables or views</strong> and click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/7.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_7.png" width="200" height="204" alt="Copy data from one or more tables or views" title="Copy data from one or more tables or views"  /></a></li><li>On <strong>Select Sources Tables and Views</strong>, select tables that you want to export. On this example, I select all tables on <strong>&#8216;Northwind&#8217;</strong> database.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/8.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_8.png" width="200" height="204" alt="Select Sources Tables and Views" title="Select Sources Tables and Views"  /></a></li><li>On <strong>Save and Run Package</strong>, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/9.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_9.png" width="200" height="204" alt="Save and Run Package" title="Save and Run Package"  /></a></li><li>On <strong>Complete the Wizard</strong>, you can verify the choices made in the wizard. Then, click <strong>Finish</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/10.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_10.png" width="200" height="204" alt="Complete the Wizard" title="Complete the Wizard"  /></a></li><li>Wait until the wizard finishes execution.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/11.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_11.png" width="200" height="204" alt="Export Data Successful" title="Export Data Successful"  /></a></li><li>Now I have exported tables of <strong>&#8216;Northwind&#8217;</strong> database from SQL Server 2008 to SQL Server 2005 successfully.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/12.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-3/_12.png" width="200" height="146" alt="The Exported Tables" title="The Exported Tables"  /></a></li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</title><link>http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/</link> <comments>http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/#comments</comments> <pubDate>Fri, 14 Aug 2009 05:30:49 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <category><![CDATA[SQL Server 2008]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=982</guid> <description><![CDATA[Generate SQL Server Scripts Wizard On Part 1: Introduction, I mentioned about error messages when you try to restore a database from SQL Server 2008 to SQL Server 2005. Now let&#8217;s see a first solution to solve the problems. On this post, you see how to backup &#8216;Northwind&#8217; database by generate a SQL Server script [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard</a> <small>Export Data Wizard On Part 1: Introduction, I mentioned about...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Generate SQL Server Scripts Wizard</h3><p>On <a
href="http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/">Part 1: Introduction</a>, I mentioned about error messages when you try to restore a database from SQL Server 2008 to SQL Server 2005. Now let&#8217;s see a first solution to solve the problems.</p><p><span
id="more-982"></span></p><p>On this post, you see how to backup &#8216;Northwind&#8217; database by generate a SQL Server script on SQL Server 2008. Then, restore the &#8216;Northwind&#8217; database by execute the SQL Server script on SQL Server 2005.</p><p></p><h3>Step-by-step</h3><ol><li>On <strong>Microsoft SQL Server Management Studio</strong>, connects to the SQL Server 2008. Right-click on the database that you want to backup and select <strong>Tasks</strong> -> <strong>Generate Scripts</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_3.png" width="200" height="146" alt="Generate Scripts" title="Generate Scripts"  /></a></li><li>On <strong>Welcome to the Generate SQL Server Scripts Wizard</strong>, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_4.png" width="200" height="179" alt="Welcome to the Generate SQL Server Scripts Wizard" title="Welcome to the Generate SQL Server Scripts Wizard"  /></a></li><li>On <strong>Select Database</strong>, select <strong>Northwind</strong> and check <strong>Script all objects in the selected database</strong>. Then, click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_5.png" width="200" height="179" alt="Select Database" title="Select Database"  /></a></li><li>On <strong>Choose Script Options</strong>, set <strong>Script Database Create</strong> to <strong>False</strong> and <strong>Script for Server Version</strong> to <strong>SQL Server 2005</strong>.<br
/> <em><strong>Note:</strong></em> You can set <strong>Script Database Create</strong> to <strong>True</strong> if your source and destination for store database files are the same location.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_6.png" width="200" height="179" alt="Script for Server Version to SQL Server 2005" title="Script for Server Version to SQL Server 2005"  /></a></li><li>Continue on <strong>Choose Script Options</strong>, scroll down and set <strong>Script Data</strong> to <strong>True</strong>. Click <strong>Next</strong><br
/> <em><strong>Note:</strong></em> Set this option to true to include data on each table to a script.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/7.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_7.png" width="200" height="191" alt="Script Data to True" title="Script Data to True"  /></a></li><li>On <strong>Output Option</strong>, select a destination for the output script. Select <strong>Script to file</strong> and browse to the location that you want. Click <strong>Next</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/8.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_8.png" width="200" height="191" alt="Select Script Output Destination" title="Select Script Output Destination"  /></a></li><li>On <strong>Script Wizard Summary</strong>, you can review your selections. Then, click <strong>Finish</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/9.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_9.png" width="200" height="191" alt="Script Wizard Summary" title="Script Wizard Summary"  /></a></li><li>On <strong>Generate Script Progress</strong>, the wizard is creating a SQL Server script.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/10.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_10.png" width="200" height="191" alt="Generate Script Progress" title="Generate Script Progress"  /></a></li><li>When the script has been completed, you see the output file as similar the figure below.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/11.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_11.png" width="200" height="140" alt="The Generated Script" title="The Generated Script"  /></a></li><li>Connect to SQL Server 2005, create a new database. Right-click <strong>Database</strong> -> <strong>New Database</strong>.<br
/> <em><strong>Note:</strong></em> If you have set <strong>Script Database Create</strong> to <strong>True</strong> on step 4, you don&#8217;t have to create a database manually.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/12.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_12.png" width="200" height="154" alt="Create New Database" title="Create New Database"  /></a></li><li>Type <strong>&#8216;Northwind&#8217;</strong> as database name. Click <strong>OK</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/13.png" target="_blank" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_13.png" width="200" height="180" alt="Create Database Northwind" title="Create Database Northwind"  /></a></li><li>Execute the SQL Server script file that you have created.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/14.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_14.png" width="200" height="154" alt="Execute the script" title="Execute the script"  /></a></li><li>Now the database <strong>&#8216;Northwind&#8217;</strong> is restored on SQL Server 2005.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/15.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-2/_15.png" width="200" height="154" alt="Northwind Database" title="Northwind Database"  /></a></li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard</a> <small>Export Data Wizard On Part 1: Introduction, I mentioned about...</small></li><li><a
href='http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</a> <small>Problem When you restore or attach a database which is...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/feed/</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>Restore Database From SQL Server 2008 to SQL Server 2005, Part 1: Introduction</title><link>http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/</link> <comments>http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/#comments</comments> <pubDate>Tue, 11 Aug 2009 03:11:32 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <category><![CDATA[SQL Server 2008]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=979</guid> <description><![CDATA[Problem When you restore or attach a database which is created from SQL Server 2008 to SQL Server 2005 or SQL Server 2000, you will see some error messages as the examples below. Backup and Restore You have backup a database from SQL Server 2008. If you try to restore the backup database file to [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard</a> <small>Export Data Wizard On Part 1: Introduction, I mentioned about...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Problem</h3><p>When you restore or attach a database which is created from SQL Server 2008 to SQL Server 2005 or SQL Server 2000, you will see some error messages as the examples below.</p><p><span
id="more-979"></span></p><p></p><h4>Backup and Restore</h4><p>You have backup a database from SQL Server 2008. If you try to restore the backup database file to SQL Server 2005, you will receive the error message:</p><p><strong>An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)<br
/> Additional information:<br
/> -> The media family on device &#8216;<em>the backup file</em>&#8216; is incorrectly formed. SQL Server cannot process this media family.<br
/> RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)</strong><br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-1/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-1/_1.png" width="200" height="180" alt="Restore Database Error Message" title="Restore Database Error Message"  /></a></p><h4>Detach and Attach</h4><p>You have detach a database from SQL Server 2008. If you try to attach the detached database file to SQL Server 2005, you will receive the error message:</p><p><strong>Attach database failed for Server <em>&#8216;SQL Server name&#8217;</em>. (Microsoft.SqlServer.Smo)<br
/> Additional information:<br
/> -> An exception occurred while executing a Transact-SQL statement batch. (Microsoft.SqlServer.ConnectionInfo)<br
/> &#8211;> The database <em>&#8216;database name&#8217;</em> cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.<br
/> Could not open new database <em>&#8216;database name&#8217;</em>. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)</strong><br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-1/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Restore-DB-From-SQL-2008-To-2005/Part-1/_2.png" width="200" height="180" alt="Attach Database Error Message" title="Attach Database Error Message"  /></a></p><h3>Solution</h3><p>These problems occur because a backup or detach database file is not backward compatible. You cannot restore or attach a database which is created from a higher version of SQL Server to a lower version of SQL Server.</p><p>But there are some alternatives which can help you to restore a database to a lower version of SQL Server. I divide into separate parts.</p><ol><li><strong><a
href="http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/">Part 2: Generate SQL Server Scripts Wizard</a></strong>. The solution creates a SQL Server script file using a wizard. Then, you simply execute the script file on SQL Server 2005 or SQL Server 2000. So you will get everything as same as the source database on the destination. But there are some disadvantages:<ul><li>If the source database contains lots of data, you will have a large script file.</li><li>The generated file is a plain text. Anyone who has access to the file can read it. So you should delete the script file after the restoration.</li></ul></li><li><strong><a
href="http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/">Part 3: Import and Export Wizard</a></strong>. This solution exports data to the targeted SQL Server using a wizard. It is more secure and effective than the first solution. But you can only export tables and views only.</li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/08/14/restore-database-from-sql-server-2008-to-sql-server-2005-part-2-generate-sql-server-scripts-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 2: Generate SQL Server Scripts Wizard</a> <small>Generate SQL Server Scripts Wizard On Part 1: Introduction, I...</small></li><li><a
href='http://www.linglom.com/2009/08/17/restore-database-from-sql-server-2008-to-sql-server-2005-part-3-export-data-wizard/' rel='bookmark' title='Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard'>Restore Database From SQL Server 2008 to SQL Server 2005, Part 3: Export Data Wizard</a> <small>Export Data Wizard On Part 1: Introduction, I mentioned about...</small></li><li><a
href='http://www.linglom.com/2008/01/12/how-to-backup-and-restore-database-on-microsoft-sql-server-2005/' rel='bookmark' title='How to backup and restore database on Microsoft SQL Server 2005'>How to backup and restore database on Microsoft SQL Server 2005</a> <small>Introduction This post will give you a brief introduction of...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/08/11/restore-database-from-sql-server-2008-to-sql-server-2005-part-1-introduction/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8217; database</title><link>http://www.linglom.com/2009/07/08/solved-system-data-sqlclient-sqlerror-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-dbname-database/</link> <comments>http://www.linglom.com/2009/07/08/solved-system-data-sqlclient-sqlerror-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-dbname-database/#comments</comments> <pubDate>Wed, 08 Jul 2009 09:09:09 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=917</guid> <description><![CDATA[Problem You have backup a database on SQL Server 2005. Then, you try to restore the backup file on an existing database and receive the error message below: Restore failed for Server &#8216;SQL Server name&#8216;. (Microsoft.SqlServer.Smo) Additional information: System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8216; database. (Microsoft.SqlServer.Smo) [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/07/03/solved-system-data-sqlclient-sqlerror-the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up/' rel='bookmark' title='[Solved] System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up'>[Solved] System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up</a> <small>Problem You have backup a database on SQL Server 2005....</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Problem</h3><p>You have backup a database on SQL Server 2005. Then, you try to restore the backup file on an existing database and receive the error message below:</p><p><span
id="more-917"></span></p><p>Restore failed for Server &#8216;<em>SQL Server name</em>&#8216;. (Microsoft.SqlServer.Smo)<br
/> <strong>Additional information:</strong><br
/> System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;<em>dbName</em>&#8216; database. (Microsoft.SqlServer.Smo)<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/_1.png" width="200" height="53" alt="The backup set holds a backup of a database other than the existing" title="The backup set holds a backup of a database other than the existing"  /></a></p><p></p><p>This error message indicates that you are going to restore a database on another database which are not the same database. For example, you have backup Northwind database and try to restore the backup to AdventureWorks database, the error will occur.</p><h3>Solution</h3><p>To solve the problem, you can use the <strong>overwrite the existing database</strong> option while you&#8217;re restoring.</p><ol><li>On <strong>Restore Database</strong>, select <strong>Options</strong> tab on the left menu. Then, check <strong>Overwrite the existing database</strong> on Restore options.<br
/> <em><strong>Note: </strong></em>This option will overwrite any existing data on the targeted database.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/_2.png" width="200" height="179" alt="Restore Database Option" title="Restore Database Option"  /></a></li><li>Try to restore the database, the problem should be gone now.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message2/_3.png" width="200" height="41" alt="Restore Database Successful" title="Restore Database Successful"  /></a></li></ol><p><em><strong>Note:</strong></em> you can also delete the targeted database before perform restore a database. This way also gives the result as same as the solution above.</p><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/07/03/solved-system-data-sqlclient-sqlerror-the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up/' rel='bookmark' title='[Solved] System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up'>[Solved] System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up</a> <small>Problem You have backup a database on SQL Server 2005....</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/07/08/solved-system-data-sqlclient-sqlerror-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-dbname-database/feed/</wfw:commentRss> <slash:comments>77</slash:comments> </item> <item><title>[Solved] System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up</title><link>http://www.linglom.com/2009/07/03/solved-system-data-sqlclient-sqlerror-the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up/</link> <comments>http://www.linglom.com/2009/07/03/solved-system-data-sqlclient-sqlerror-the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up/#comments</comments> <pubDate>Fri, 03 Jul 2009 06:33:13 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2005]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=922</guid> <description><![CDATA[Problem You have backup a database on SQL Server 2005. Then, you try to restore the backup file on the existing database and receive the error message below: Restore failed for Server &#8216;SQL Server name&#8216;. (Microsoft.SqlServer.Smo) Additional information: System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;dbName&#8221; has not been backed up. Use BACKUP [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2009/07/08/solved-system-data-sqlclient-sqlerror-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-dbname-database/' rel='bookmark' title='[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8217; database'>[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8217; database</a> <small>Problem You have backup a database on SQL Server 2005....</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Problem</h3><p>You have backup a database on SQL Server 2005. Then, you try to restore the backup file on the existing database and receive the error message below:</p><p><span
id="more-922"></span></p><p>Restore failed for Server &#8216;<em>SQL Server name</em>&#8216;. (Microsoft.SqlServer.Smo)<br
/> <strong>Additional information:</strong><br
/> System.Data.SqlClient.SqlError: The tail of the log for the database &#8220;<em>dbName</em>&#8221; has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log. (Microsoft.SqlServer.Smo)<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/_1.png" width="200" height="62" alt="The tail of the log for the database 'dbName' has not been backed up" title="The tail of the log for the database 'dbName' has not been backed up"  /></a></p><p>This error message is likely to be a warning message rather than an error message. It indicates that you are going to restore a database to replace the existing database and some data may be lose. For example, you perform backup on this following schedule:</p><ul><li>database at 10:00 AM</li><li>transaction log at 11:00 AM</li><li>transaction log at 01:00 PM</li></ul><p>Now if you are going to restore the backup at 04:00 PM. You will lose any work after 01:00 till 04:00 which is same as the error message above try to warn you.</p><p></p><h3>Solution</h3><p>To solve the problem, you can either:</p><ul><li>Replace the existing database with a backup file. This option is fast and easy but you will lose any work after the last backup has been performed.</li><li>Do backup transaction log again with NORECOVERY option before restoring a database. With NORECOVERY option, the database will be in restoring state and waiting for restoration.</li></ul><p>In this post, I will show only the first solution only. For the second solution, see <a
href="http://msdn.microsoft.com/en-us/library/dd297499.aspx" target="_blank" rel="nofollow">How to: Back Up the Tail of the Transaction Log (SQL Server Management Studio)</a></p><h4>Restore by overwrite an existing database</h4><ol><li>On <strong>Restore Database</strong>, select <strong>Options</strong> tab on the left menu. Then, check <strong>Overwrite the existing database</strong> on Restore options.<br
/> <em><strong>Note: </strong></em>This option will overwrite any existing data on the targeted database.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/_2.png" width="200" height="179" alt="Restore Database Options" title="Restore Database Options"  /></a></li><li>Try to restore the database, the problem should be gone now.<br
/> <a
href="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/SQL-Server/Backup-Restore/Troubleshoot/Message1/_3.png" width="200" height="41" alt="Restore Database Successful" title="Restore Database Successful"  /></a></li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2009/07/08/solved-system-data-sqlclient-sqlerror-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-dbname-database/' rel='bookmark' title='[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8217; database'>[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing &#8216;dbName&#8217; database</a> <small>Problem You have backup a database on SQL Server 2005....</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/07/03/solved-system-data-sqlclient-sqlerror-the-tail-of-the-log-for-the-database-dbname-has-not-been-backed-up/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>Enable Remote Connection on SQL Server 2008 Express</title><link>http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/</link> <comments>http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/#comments</comments> <pubDate>Sat, 28 Mar 2009 12:55:09 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[SQL Server 2008]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=665</guid> <description><![CDATA[Introduction Last time, I wrote an article show how to enable remote connection on SQL Server 2005 Express. Now SQL Server 2008 Express is released for a while, it doesn&#8217;t allow remote connection on default installation as on SQL Server 2005 Express. So you have to enable it manually. If you&#8217;re trying to connect to [...]
Related posts:<ol><li><a
href='http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/' rel='bookmark' title='Enable remote connection to SQL Server 2005 Express'>Enable remote connection to SQL Server 2005 Express</a> <small>Introduction By default, SQL Server 2005 doesn’t allow remote connection...</small></li><li><a
href='http://www.linglom.com/2011/12/07/how-to-install-sample-databases-northwind-and-pubs-in-sql-server-2008-express/' rel='bookmark' title='How to Install Sample Databases (Northwind and Pubs) in SQL Server 2008 Express'>How to Install Sample Databases (Northwind and Pubs) in SQL Server 2008 Express</a> <small>The databases, such Northwind and Pubs, are sample databases which...</small></li><li><a
href='http://www.linglom.com/2008/10/04/how-to-enable-remote-desktop-web-connection-on-windows/' rel='bookmark' title='How to Enable Remote Desktop Web Connection on Windows'>How to Enable Remote Desktop Web Connection on Windows</a> <small>Introduction Remote Desktop Connection is one useful tool of Windows...</small></li></ol>]]></description> <content:encoded><![CDATA[<h3>Introduction</h3><p>Last time, I wrote an article show how to <a
href="http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/">enable remote connection on SQL Server 2005 Express</a>. Now SQL Server 2008 Express is released for a while, it doesn&#8217;t allow remote connection on default installation as on SQL Server 2005 Express. So you have to enable it manually.</p><p><span
id="more-665"></span></p><p></p><p>If you&#8217;re trying to connect to SQL Server 2008 Express remotely without enable remote connection first, you may see these error messages:</p><ul><li><strong>&#8220;Cannot connect to <em>SQL-Server-Instance-Name</em><br
/> An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 28 &#8211; Server doesn&#8217;t support requested protocol) (Microsoft SQL Server)&#8221;</strong><br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_1.png" width="200" height="62" alt="Server doesn't support requested protocol" title="Server doesn't support requested protocol"  /></a></li><li><strong>&#8220;Cannot connect to <em>SQL-Server-Instance-Name</em><br
/> An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 &#8211; Error Locating Server/Instance Specified) (Microsoft SQL Server)&#8221;</strong><br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_2.png" width="200" height="62" alt="Error Locating Server/Instance Specified" title="Error Locating Server/Instance Specified"  /></a></li><li><strong>&#8220;Cannot connect to <em>SQL-Server-Instance-Name</em><br
/> Login failed for user &#8216;<em>username</em>&#8216;. (Microsoft SQL Server, Error: 18456)&#8221;</strong><br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_3.png" width="200" height="49" alt="Login failed for user 'sa'" title="Login failed for user 'sa'"  /></a></li></ul><p>To enable remote connection on SQL Server 2008 Express, see the step below:</p><ol><li>Start SQL Server Browser service if it&#8217;s not started yet. SQL Server Browser listens for incoming requests for Microsoft SQL Server resources and provides information about SQL Server instances installed on the computer.</li><li>Enable TCP/IP protocol for SQL Server 2008 Express to accept remote connection.</li><li><strong>(Optional)</strong> Change Server Authentication to SQL Server and Windows Authentication. By default, SQL Server 2008 Express allows only Windows Authentication mode so you can connect to the SQL Server with current user log-on credential. If you want to specify user for connect to the SQL Server, you have to change Server Authentication to SQL Server and Windows Authentication.</li></ol><p><em><strong>Note:</strong></em> In SQL Server 2008 Express, there isn&#8217;t <strong>SQL Server Surface Area Configuration</strong> so you have to configure from <strong>SQL Server Configuration Manager</strong> instead.</p><h3>Step-by-step</h3><ol><li>Open SQL Server Configuration Manager. Click <strong>Start</strong> -> <strong>Programs</strong> -> <strong>Microsoft SQL Server 2008</strong> -> <strong>Configuration Tools</strong> -> <strong>SQL Server Configuration Manager</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_4.png" width="200" height="91" alt="SQL Server Configuration Manager" title="SQL Server Configuration Manager"  /></a></li><li>On SQL Server Configuration Manager, select <strong>SQL Server Services</strong> on the left window. If the state on SQL Server Browser is not running, you have to configure and start the service. Otherwise, you can skip to step 6.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_5.png" width="200" height="136" alt="SQL Server Browser Service" title="SQL Server Browser Service"  /></a></li><li>Double-click on SQL Server Browser, the Properties window will show up. Set the account for start <strong>SQL Server Browser Service</strong>. In this example, I set to <strong>Local Service</strong> account.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/6.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_6.png" width="200" height="224" alt="Set Startup Account" title="Set Startup Account"  /></a></li><li>On SQL Server Browser Properties, move to <strong>Service</strong> tab and change <strong>Start Mode</strong> to <strong>Automatic</strong>. Therefore, the service will be start automatically when the computer starts. Click <strong>OK</strong> to apply changes.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/7.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_7.png" width="200" height="224" alt="Set Start Mode to Automatic" title="Set Start Mode to Automatic"  /></a></li><li>Back to SQL Server Configuration Manager, right-click on <strong>SQL Server Bowser</strong> on the right window and select <strong>Start</strong> to start the service.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/8.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_8.png" width="200" height="136" alt="Start SQL Server Browser Service" title="Start SQL Server Browser Service"  /></a></li><li>On the left window, expand <strong>SQL Server Network Configuration</strong> -> <strong>Protocols for SQLEXPRESS</strong>. You see that TCP/IP protocol status is disabled.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/9.png" target="_blank" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_9.png" width="200" height="143" alt="Protocols for SQL EXPRESS" title="Protocols for SQL EXPRESS"  /></a></li><li>Right-click on <strong>TCP/IP</strong> and select <strong>Enable</strong> to enable the protocol.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/10.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_10.png" width="200" height="143" alt="Enable TCP/IP protocol" title="Enable TCP/IP protocol"  /></a></li><li>There is a pop-up shown up that you have to restart the SQL Service to apply changes.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/11.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_11.png" width="200" height="42" alt="Need to Restart SQL Server Service" title="Need to Restart SQL Server Service"  /></a></li><li>On the left window, select <strong>SQL Server Services</strong>. Select <strong>SQL Server (SQLEXPRESS)</strong> on the right window -> click <strong>Restart</strong>. The SQL Server service will be restarted.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/12.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_12.png" width="200" height="143" alt="Restart SQL Server Service" title="Restart SQL Server Service"  /></a></li><li>Open Microsoft SQL Server Management Studio and connect to the SQL Server 2008 Express.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/13.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_13.png" width="200" height="154" alt="Open Microsoft SQL Server Management Studio" title="Open Microsoft SQL Server Management Studio"  /></a></li><li>Right-click on the SQL Server Instance and select <strong>Properties</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/14.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_14.png" width="200" height="154" alt="Open Server Properties" title="Open Server Properties"  /></a></li><li>On Server Properties, select <strong>Security</strong> on the left window. Then, select <strong>SQL Server and Windows Authentication</strong> mode.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/15.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_15.png" width="200" height="180" alt="Change Authentication to SQL Server and Windows Authentication" title="Change Authentication to SQL Server and Windows Authentication"  /></a></li><li>Again, there is a pop-up shown up that you have to restart the SQL Service to apply changes.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/16.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_16.png" width="200" height="43" alt="Need to Restart SQL Server Service" title="Need to Restart SQL Server Service"  /></a></li><li>Right-click on the SQL Server Instance and select <strong>Restart</strong>.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/17.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/Enable-Remote-SQL-2008/_17.png" width="200" height="154" alt="Restart SQL Server Service" title="Restart SQL Server Service"  /></a></li><li>That&#8217;s it. Now you should be able to connect to the SQL Server 2008 Express remotely.</li></ol><p>Related posts:<ol><li><a
href='http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/' rel='bookmark' title='Enable remote connection to SQL Server 2005 Express'>Enable remote connection to SQL Server 2005 Express</a> <small>Introduction By default, SQL Server 2005 doesn’t allow remote connection...</small></li><li><a
href='http://www.linglom.com/2011/12/07/how-to-install-sample-databases-northwind-and-pubs-in-sql-server-2008-express/' rel='bookmark' title='How to Install Sample Databases (Northwind and Pubs) in SQL Server 2008 Express'>How to Install Sample Databases (Northwind and Pubs) in SQL Server 2008 Express</a> <small>The databases, such Northwind and Pubs, are sample databases which...</small></li><li><a
href='http://www.linglom.com/2008/10/04/how-to-enable-remote-desktop-web-connection-on-windows/' rel='bookmark' title='How to Enable Remote Desktop Web Connection on Windows'>How to Enable Remote Desktop Web Connection on Windows</a> <small>Introduction Remote Desktop Connection is one useful tool of Windows...</small></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/feed/</wfw:commentRss> <slash:comments>280</slash:comments> </item> <item><title>Optional parameters in Stored Procedure</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/</link> <comments>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/#comments</comments> <pubDate>Fri, 12 Sep 2008 01:52:35 +0000</pubDate> <dc:creator>linglom</dc:creator> <category><![CDATA[MS SQL Server]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[Stored Procedure]]></category> <guid
isPermaLink="false">http://www.linglom.com/?p=194</guid> <description><![CDATA[Introduction When you create a store procedure on Microsoft SQL Server with some input parameters, sometimes you don&#8217;t want to assign all of parameters (optional parameters) so you need to specify default value for the parameters. Otherwise, it shows error when execute the store procedure. Let&#8217;s see some example, I have created a new store [...]
No related posts.]]></description> <content:encoded><![CDATA[<h3>Introduction</h3><p>When you create a store procedure on Microsoft SQL Server with some input parameters, sometimes you don&#8217;t want to assign all of parameters (optional parameters) so you need to specify default value for the parameters. Otherwise, it shows error when execute the store procedure.</p><p><span
id="more-194"></span></p><p></p><p>Let&#8217;s see some example, I have created a new store procedure to query product name from Northwind database which require 2 input parameters. The script to create a sample store procedure is below:</p><div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> sp_getproduct
		<span style="color: #66cc66;">&#40;</span>@UnitPrice money<span style="color: #66cc66;">,</span>
		 @UnitsInStock <span style="color: #993333; font-weight: bold;">SMALLINT</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'10'</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
	<span style="color: #993333; font-weight: bold;">SET</span> NOCOUNT <span style="color: #993333; font-weight: bold;">ON</span>;
&nbsp;
	<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">&#91;</span>ProductName<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">FROM</span> Products
		<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitPrice<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&lt;</span> @UnitPrice<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
			  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitsInStock<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> @UnitsInStock<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div><p><a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/1.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/_1.png" width="250" height="166" alt="" title=""  /></a></p><p>So as long as I specify both input parameters, the query is OK.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/2.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/_2.png" width="250" height="216" alt="" title=""  /></a></p><p>But if I miss an input parameter, the error will be shown as the figure below:<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/3.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/_3.png" width="250" height="140" alt="" title=""  /></a></p><h3>Solution</h3><ol><li>You can define the default value for parameters to avoid this error message. The default value generally is NULL. But you also can define other value as you want.</li><li>In this example, I&#8217;ve altered the store procedure by assign default value for these parameters to be NULL and also in WHERE clause.<div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> sp_getproduct
		<span style="color: #66cc66;">&#40;</span>@UnitPrice money <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
		 @UnitsInStock <span style="color: #993333; font-weight: bold;">SMALLINT</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
	<span style="color: #993333; font-weight: bold;">SET</span> NOCOUNT <span style="color: #993333; font-weight: bold;">ON</span>;
&nbsp;
	<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">&#91;</span>ProductName<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">FROM</span> Products
		<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>@UnitPrice <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitPrice<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&lt;</span> @UnitPrice<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
			  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>@UnitsInStock <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitsInStock<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> @UnitsInStock<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div><p><strong>Code Explanation:</strong></p><ul><li>I&#8217;ve altered the parameters declaration to assign the NULL value as the default value.<div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;">		<span style="color: #66cc66;">&#40;</span>@UnitPrice money <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
		 @UnitsInStock <span style="color: #993333; font-weight: bold;">SMALLINT</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span></pre></div></div></li><li>Next, I&#8217;ve altered in WHERE clause to be TRUE if the parameters are NULL. So if the both parameters are NULL, the SELECT statement will return all ProductName from Products table.<div
class="wp_syntax"><div
class="code"><pre class="sql" style="font-family:monospace;">		<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>@UnitPrice <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitPrice<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&lt;</span> @UnitPrice<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AND</span>
			  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>@UnitsInStock <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>UnitsInStock<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> @UnitsInStock<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div></li></ul><p><a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/4.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/_4.png" width="250" height="158" alt="" title=""  /></a></li><li>Re-execute the query again, you&#8217;ll see the error message is gone.<br
/> <a
href="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/5.png" target="_blank"><img
src="http://www.linglom.com/images/Windows/Programming/SQLServer/OptionalSP/_5.png" width="250" height="237" alt="" title=""  /></a></li></ol><p>No related posts.</p>]]></content:encoded> <wfw:commentRss>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 8/81 queries in 0.039 seconds using disk: basic
Content Delivery Network via cdn.linglom.com/linglom

Served from: www.linglom.com @ 2012-02-05 04:35:55 -->
