{"id":15,"date":"2009-05-27T13:23:00","date_gmt":"2009-05-27T07:53:00","guid":{"rendered":"http:\/\/guganeshan.com\/blog\/?p=15"},"modified":"2009-12-18T13:48:22","modified_gmt":"2009-12-18T08:18:22","slug":"scripts-generated-from-sql-server-2005-management-studio-are-incompatible-with-sql-server-2000","status":"publish","type":"post","link":"https:\/\/guganeshan.com\/blog\/scripts-generated-from-sql-server-2005-management-studio-are-incompatible-with-sql-server-2000.html","title":{"rendered":"Scripts generated from SQL Server 2005 Management Studio are incompatible with SQL Server 2000"},"content":{"rendered":"<p>If you ever generated scripts using SQL Server 2005 using Management Studio by right-clicking on table names, and tried executing it in SQL Server 2000 (using Query Analyzer), you would have encountered this problem&#8230; The Query Analyzer would report syntax errors.<!--more--><\/p>\n<p align=\"center\"><strong><span style=\"text-decoration: underline;\"><span style=\"color:#000000;\">Reproducing the problem:<\/span><\/span><\/strong><\/p>\n<p><strong>Right-click on a table and generate a CREATE TABLE script from SQL Server 2005 Management Studio:<\/strong><\/p>\n<p><a href=\"http:\/\/lh6.ggpht.com\/_UWvYGQG7P2Y\/Sh03iHy4u1I\/AAAAAAAAAHU\/geW9V34Ewts\/s1600-h\/createscriptsqlms14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px;\" src=\"http:\/\/lh3.ggpht.com\/_UWvYGQG7P2Y\/Sh03kGx1CyI\/AAAAAAAAAHY\/to0aX6QJBPo\/createscriptsqlms_thumb10.png?imgmax=800\" border=\"0\" alt=\"create script sqlms\" width=\"522\" height=\"252\" \/><\/a><\/p>\n<p><strong>Paste the generated script in SQL Server 2000, Query Analyzer and verify the syntax by clicking on the &#8220;Parse Query&#8221; tool button or press CTRL + F5:<\/strong><\/p>\n<p><a href=\"http:\/\/lh5.ggpht.com\/_UWvYGQG7P2Y\/Sh03lBI7uFI\/AAAAAAAAAHc\/jE4V80kvl7k\/s1600-h\/verifysyntax5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px;\" src=\"http:\/\/lh5.ggpht.com\/_UWvYGQG7P2Y\/Sh03maI-5dI\/AAAAAAAAAHg\/ah087QwYTIU\/verifysyntax_thumb3.png?imgmax=800\" border=\"0\" alt=\"verify syntax\" width=\"183\" height=\"49\" \/><\/a><\/p>\n<p><strong>Query Analyzer would report syntax errors:<\/strong><\/p>\n<p>You will get a load of &#8220;Incorrect syntax near &#8216;(&#8216; &#8221; or similar errors depending on the number of table queries you generated.<\/p>\n<p><a href=\"http:\/\/lh3.ggpht.com\/_UWvYGQG7P2Y\/Sh03nXIMcvI\/AAAAAAAAAHk\/6JxCFzBMFJs\/s1600-h\/QueryAnalyzerSynaxErrors5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px;\" src=\"http:\/\/lh6.ggpht.com\/_UWvYGQG7P2Y\/Sh03okSCWQI\/AAAAAAAAAHo\/idpmKz7w8SI\/QueryAnalyzerSynaxErrors_thumb3.png?imgmax=800\" border=\"0\" alt=\"QueryAnalyzerSynaxErrors\" width=\"372\" height=\"103\" \/><\/a><\/p>\n<p align=\"center\"><strong><span style=\"color:#000000;\"> <\/span><\/strong><\/p>\n<p align=\"center\"><strong><span style=\"color:#000000;\"><span style=\"text-decoration: underline;\">Solution for people who manage the target SQL Server 2000 database using SQL Server 2005 Management Studio<\/span><\/span><\/strong><\/p>\n<p>I found this solution when I Googled: <a title=\"http:\/\/www.waynejohn.com\/post\/2008\/03\/21\/Scripting-a-SQL-2000-Database-from-SQL-2005.aspx\" href=\"http:\/\/www.waynejohn.com\/post\/2008\/03\/21\/Scripting-a-SQL-2000-Database-from-SQL-2005.aspx\">http:\/\/www.waynejohn.com\/post\/2008\/03\/21\/Scripting-a-SQL-2000-Database-from-SQL-2005.aspx<\/a><\/p>\n<p>But note that Wayne John, the author of the blog says he couldn&#8217;t find the &#8220;Scripting&#8221; section in the &#8220;<strong>Tools &#8211;&gt; Options<\/strong>&#8221; dialog box in one of his systems, where he had only SQL 2005 installed!<\/p>\n<p align=\"center\"><strong><span style=\"text-decoration: underline;\"><span style=\"color:#000000;\">The solution for people who don&#8217;t have SQL Server Management Studio installed at the target to manage the SQL Server 2000<\/span><\/span><\/strong><\/p>\n<p>So If you are like me&#8230; using SQL Server 2000 + Query Analyzer at the target server while the source is a SQL Server 2005 + Management Studio, you can use the good old <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&amp;displaylang=en\" target=\"_blank\"><strong>SQL Server Database Publishing Wizard<\/strong><\/a><strong> <\/strong>to export schema.<\/p>\n<p>The queries generated using the SQL Server Database Publishing Wizard worked perfectly with SQL Server 2000&#8217;s Query Analyzer (though a query for even a single table would look scary!).<\/p>\n<p>But make sure you select &#8220;SQL Server 2000&#8221; as the value for the &#8220;Script for target database&#8221; property in the &#8220;Select Publishing Options&#8221; in the wizard.<\/p>\n<p><a href=\"http:\/\/lh5.ggpht.com\/_UWvYGQG7P2Y\/Sh03p_G08iI\/AAAAAAAAAHs\/m-6Q3_Z86EU\/s1600-h\/scriptfortargetdatabase5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px;\" src=\"http:\/\/lh3.ggpht.com\/_UWvYGQG7P2Y\/Sh03rY8g_6I\/AAAAAAAAAHw\/QDvvPxrQGa0\/scriptfortargetdatabase_thumb3.png?imgmax=800\" border=\"0\" alt=\"script for target database\" width=\"354\" height=\"295\" \/><\/a><\/p>\n<p><span style=\"color:#ff0000;\">NOTE: Double-check the &#8220;Drop existing objects in script&#8221; option to make sure it has &#8220;false&#8221; (unless you really want to drop objects)<\/span><\/p>\n<p>There are plenty of other tools out there too, for example from <a href=\"http:\/\/www.red-gate.com\/\" target=\"_blank\">Red Gate Software<\/a>. But as a free piece software <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&amp;displaylang=en\" target=\"_blank\">SQL Server Database Publishing Wizard<\/a> offers enough for my needs of exporting schema and data from\/to SQL Server 2005 and SQL Server 2000 databases.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>If you ever generated scripts using SQL Server 2005 using Management Studio by right-clicking on table names, and tried executing it in SQL Server 2000 (using Query Analyzer), you would have encountered this problem&#8230; The Query Analyzer would report syntax errors.<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[16,68],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-troubleshooting","tag-sql-server","tag-troubleshooting"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":4,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guganeshan.com\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}