{"id":4824,"date":"2007-10-15T16:24:00","date_gmt":"2007-10-15T16:24:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2007\/10\/15\/sql-database-publishing-wizard-is-now-in-visual-studio-2008\/"},"modified":"2007-10-15T16:24:00","modified_gmt":"2007-10-15T16:24:00","slug":"sql-database-publishing-wizard-is-now-in-visual-studio-2008","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/sql-database-publishing-wizard-is-now-in-visual-studio-2008\/","title":{"rendered":"SQL Database Publishing wizard is now in Visual Studio 2008."},"content":{"rendered":"<p><P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\"><SPAN>The SQL database publishing wizard is a very popular web-downloadable add-in for Visual Studio 2005. The publishing wizard addresses the issue where a developer needs to deploy a local database from his development machine to a hosting environment on a remote machine. <\/SPAN><SPAN>We received a lot of positive feedback for this wizard and we decided to integrate this with Visual Studio 2008. This is a feature that was added post Beta2 and will be available with Visual Studio 2008 RTM.<\/SPAN><\/FONT><\/FONT><\/P>\n<P class=\"MsoNormal\"><SPAN><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><FONT size=\"3\"><FONT face=\"Times New Roman\">The wizard supports two key database hosting deployment scenarios:<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P>\n<P class=\"MsoListParagraph\"><FONT face=\"Times New Roman\"><B><I><SPAN><SPAN><FONT size=\"3\">1.<\/FONT><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><\/I><\/B><B><I><FONT size=\"3\">It generates a single .SQL script file which can be used to recreate a database on a remote machine<\/FONT><\/I><\/B><\/FONT><\/P>\n<P><SPAN><FONT size=\"3\"><FONT face=\"Times New Roman\">Using the Database Publishing Wizard&nbsp; you can point to a database on your local machine, and then automatically create a .SQL script file that contains the setup logic needed to re-create a replica of the database on any remote system &#8211; for example an external hosting system.&nbsp;This .SQL script includes everything needed to create the database schema (tables, views, sprocs, triggers, full-text catalogs, roles, rules, etc). You also have the option of populating the new database with the same data contents as your local tables. Most hosters today support the upload and running of .SQL files to their hosted environments using their admin control panels. So, all you need to do is upload and run the .SQL script generated by the Database Publishing Wizard, and you will have a working database in your hosted environment. This should considerably reduce the effort required to deploy your databases.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoListParagraphCxSpFirst\"><FONT face=\"Times New Roman\"><B><I><SPAN><SPAN><FONT size=\"3\">2.<\/FONT><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><\/SPAN><\/SPAN><\/I><\/B><B><I><FONT size=\"3\">It connects to a web service provided by your hoster and directly creates objects on a specified hosted database.<\/FONT><\/I><\/B><\/FONT><\/P>\n<P class=\"MsoListParagraphCxSpMiddle\"><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/P>\n<P class=\"MsoListParagraphCxSpMiddle\"><FONT face=\"Times New Roman\" size=\"3\">The Database Publishing Wizard also&nbsp;enables you to point at a database you are working with on your local system, and then use web-services to transfer and recreate&nbsp;the database in your remote hoster environment (without you having to create the .SQL file or use the hoster admin control panel to&nbsp;run&nbsp;it).&nbsp; This publishing option does require that a SQL Publishing web-service be exposed in the hosting environment, and the SQL Server Hosting Toolkit includes a free implementation of this SQL Publishing web-service that we&#8217;ll be working with hosters to aggressively deploy<\/FONT><\/P>\n<P class=\"MsoListParagraphCxSpLast\"><SPAN><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><SPAN><FONT face=\"Times New Roman\" size=\"3\">The release version of&nbsp;<\/FONT><\/SPAN><FONT size=\"3\"><FONT face=\"Times New Roman\"> Visual Studio 2008 will come pre-installed with the 1.2 version of SQL Publishing Wizard.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\"><SPAN><FONT size=\"3\"><FONT face=\"Times New Roman\">So now that you know what the Database Publishing wizard does, let us dig deeper into how it will work with&nbsp;Visual Studio 2008.<\/FONT><\/FONT><\/SPAN><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\"><B>Step 1: <\/B>Create a new website by selecting menu File -&gt;New Web Site.<B> <\/B>Switch to Server Explorer and add a new Data connection and connect to a database. In this case we will use the Northwind database that comes with SQL Express. You should point to the database you want to publish.<\/FONT><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\"><B>Step 2: <\/B>Select Northwind.dbo node in Server explorer and right click to bring up the context menu. In the Context menu you have a \u201cPublish to provider\u2026\u201d option.<\/FONT><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\"><\/FONT>&nbsp;<\/P>\n<P class=\"MsoNormal\"><IMG height=\"385\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/05\/46\/38\/44\/ServerExplorer.JPG\" width=\"213\" align=\"middle\"><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\"><\/FONT>&nbsp;<\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\"><B>Step 3: <\/B>Click<SPAN>&nbsp; <\/SPAN>\u201cPublish to provider \u2026\u201d to launch the Database Publishing Wizard.<\/FONT><\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\"><\/FONT>&nbsp;<\/P>\n<P class=\"MsoNormal\"><IMG height=\"442\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/05\/46\/46\/90\/Step1.JPG\" width=\"491\" align=\"middle\"><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\"><\/FONT><\/FONT>&nbsp;<\/P><FONT size=\"3\"><FONT face=\"Times New Roman\">\n<P class=\"MsoNormal\"><B>Step 4: <\/B>Click Next to select the mode. Let us go with \u201cScript to file\u201d mode. We will need to specify the .SQL file name and location.<\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><IMG height=\"427\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/05\/46\/38\/91\/ScriptLocation.JPG\" width=\"491\" align=\"middle\"><\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><B>Step 5: <\/B>Click Next and you will get to the Publishing Options. On this page, select the script for target database (SQL Server 2000 or SQL Server 2005) and the types of data to publish (Schema, Data or Schema+Data). You also have the option to drop existing object in script if you want to.<\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><IMG height=\"427\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/05\/46\/38\/54\/PublishingOptionJPG.JPG\" width=\"491\" align=\"middle\"><\/P>\n<P class=\"MsoNormal\"><B>&nbsp;<\/B><\/P>\n<P class=\"MsoNormal\"><STRONG>Step 6: <\/STRONG>Keep the default selection and hit next and generate the .SQL script.<\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><B>Step 7: <\/B>The .SQL file<SPAN>&nbsp; <\/SPAN>generated contains a script that you can run on any SQL server to re-create all the tables, sprocs, views, triggers, full-text catalogs, etc. for a database, as well as import and add all of the table row data that was in the database at the time the .SQL file was created.<SPAN>&nbsp;<\/SPAN><\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><B>Step 8: <\/B>The .SQL file is a plain text file. You can open it in your favorite editor and customize it as you need. <\/P>\n<P class=\"MsoNormal\">&nbsp;<\/P>\n<P class=\"MsoNormal\"><B>Step 9: <\/B>Now that we have our .SQL files, we can go about using them to install our database at our hoster.&nbsp;Exactly how to install the .SQL files will vary depending on how the hoster give access to our SQL account.&nbsp; Some hosters provide an&nbsp;HTML based file-upload tool that allows you to provide a .SQL file &#8211; which they will then execute against the SQL database you own.&nbsp; <\/P>\n<P>Other hosters provide an online query tool (like below)&nbsp;that allows you to copy\/paste SQL statements to run against your database.&nbsp; If you have a hoster which provides an online query tool like this, then you can open the .SQL file with a text-editor and copy\/paste the contents into the query textbox and run it.<\/P>\n<P class=\"MsoNormal\">&nbsp;<IMG height=\"330\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/QueryAnalyser.jpg\" width=\"797\" align=\"middle\"><\/P><\/FONT><\/FONT>\n<P class=\"MsoNormal\"><B><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/B><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\">And that is all there is to using the Database Publishing Wizard. Hope this feature is useful to you.<\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\" size=\"3\">&nbsp;<\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT size=\"3\"><FONT face=\"Times New Roman\">Scott Guthrie also has a nice blog entry on this. You can read it <SPAN>&nbsp;<\/SPAN><\/FONT><\/FONT><A href=\"http:\/\/weblogs.asp.net\/scottgu\/archive\/2006\/12\/22\/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx\"><FONT face=\"Times New Roman\" size=\"3\">here<\/FONT><\/A><FONT face=\"Times New Roman\" size=\"3\">.<\/FONT><\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\"><FONT size=\"3\"><EM><\/EM><\/FONT><\/FONT>&nbsp;<\/P>\n<P class=\"MsoNormal\"><FONT face=\"Times New Roman\"><FONT size=\"3\"><EM>~&nbsp;Reshmi Mangalore<\/EM><\/FONT><\/FONT><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The SQL database publishing wizard is a very popular web-downloadable add-in for Visual Studio 2005. The publishing wizard addresses the issue where a developer needs to deploy a local database from his development machine to a hosting environment on a remote machine. We received a lot of positive feedback for this wizard and we decided [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7265,31,7262,7273,147,7267,7264,7268],"class_list":["post-4824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-announcements","tag-asp-net","tag-development","tag-orcas","tag-visual-studio","tag-vwd","tag-wap","tag-web"],"acf":[],"blog_post_summary":"<p>The SQL database publishing wizard is a very popular web-downloadable add-in for Visual Studio 2005. The publishing wizard addresses the issue where a developer needs to deploy a local database from his development machine to a hosting environment on a remote machine. We received a lot of positive feedback for this wizard and we decided [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=4824"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4824\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=4824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=4824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=4824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}