{"id":134,"date":"2009-03-24T10:45:21","date_gmt":"2009-03-24T15:45:21","guid":{"rendered":"http:\/\/nukeitmike.com\/blog\/2009\/03\/24\/sql-queries\/%20"},"modified":"2009-03-24T10:45:21","modified_gmt":"2009-03-24T15:45:21","slug":"sql-queries","status":"publish","type":"post","link":"https:\/\/blog.nukeitmike.com\/index.php\/2009\/03\/24\/sql-queries\/","title":{"rendered":"SQL Queries"},"content":{"rendered":"<p>I don\u2019t usually do a lot with SQL, but lately I have found myself having to look at, and work with SQL a good bit.&#160; It seems that things come in waves.&#160; <\/p>\n<p>Anyway, I was looking for a quick way to copy a table from one Database to another and came across this blog which I think has a lot of good queries just waiting to be tinkered with:<\/p>\n<blockquote>\n<p><a title=\"http:\/\/www.sqlservercurry.com\/\" href=\"http:\/\/www.sqlservercurry.com\/\">http:\/\/www.sqlservercurry.com\/<\/a><\/p>\n<\/blockquote>\n<p>And the particular post that got me there was:<\/p>\n<blockquote>\n<h5><a href=\"http:\/\/www.sqlservercurry.com\/2008\/03\/copy-table-from-one-database-to-another.html\">Copy a table from one database to another in SQL Server 2005<\/a><\/h5>\n<p>4:09 AM Posted by Suprotim Agarwal      <br \/>Labels: <a href=\"http:\/\/www.sqlservercurry.com\/search\/label\/SQL%20Server%20Administration\">SQL Server Administration<\/a> <\/p>\n<p>If you have a table in a database and you would like to copy the table to another database, use this query:      <br \/>SELECT * INTO AdventureWorks.dbo.CustomersTemp FROM Northwind.dbo.Customers       <br \/>Just remember that using this query will only transfer the schema and data. It does not transfer the indexes, foreign keys, statistics etc.       <br \/>If you want to transfer all the objects from one database to another, open Sql Server Management Studio &gt; Right click on your database &gt; All Tasks &gt; Generate SQL Scripts. Then run these scripts against the new database.       <br \/><strong>Transfer both schema and data<\/strong>       <br \/>To copy both data and schema, use the <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&amp;displaylang=en\">Microsoft SQL Server Database Publishing Wizard 1.1.<\/a> This tool works for both SQL 2000 and SQL 2005 and generates a single SQL script file which can be used to recreate a database (both schema and data). <\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I don\u2019t usually do a lot with SQL, but lately I have found myself having to look at, and work with SQL a good bit.&#160; It seems that things come in waves.&#160; Anyway, I was looking for a quick way to copy a table from one Database to another and came across this blog which&hellip; <a class=\"more-link\" href=\"https:\/\/blog.nukeitmike.com\/index.php\/2009\/03\/24\/sql-queries\/\">Continue reading <span class=\"screen-reader-text\">SQL Queries<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,32],"tags":[56,120,166],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-sql","tag-blogs","tag-microsoft","tag-sql","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pcW544-2a","_links":{"self":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/comments?post=134"}],"version-history":[{"count":0,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts\/134\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/media?parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/categories?post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/tags?post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}