{"id":1429,"date":"2011-09-16T09:01:08","date_gmt":"2011-09-16T16:01:08","guid":{"rendered":"http:\/\/juixe.com\/techknow\/?p=1429"},"modified":"2011-09-16T08:32:46","modified_gmt":"2011-09-16T15:32:46","slug":"create-sql-server-database-and-database-tables-from-a-file","status":"publish","type":"post","link":"http:\/\/juixe.com\/techknow\/index.php\/2011\/09\/16\/create-sql-server-database-and-database-tables-from-a-file\/","title":{"rendered":"Create SQL Server Database and Database Tables From a File"},"content":{"rendered":"<p>When working with a database, it&#8217;s is always handy to develop a series of scripts to backup, restore, create, move databases around.  As of late, I&#8217;ve been working with SQL Server a lot so I&#8217;ve come to appreciate the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms162773.aspx\">sqlcmd utility<\/a>.<\/p>\n<p>You can run the <b>sqlcmd utility<\/b> from the command line and run a input sql script and capture the output in a file.  The input sql script file can run any sql statement, such as creating a new databases, views, tables, or procedures.  You can also restore and backup any given database or whatever else you require.<\/p>\n<p>To run the <b>sqlcmd utility<\/b> and have it read a file, createTables.sql, you can run something like the following from your command line, of course if you have SQL Server Management Studio and sqlcmd installed.<\/p>\n<pre>\r\nsqlcmd -S localhost -d dbName -U user -P password -i createTables.sql -o output.out\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When working with a database, it&#8217;s is always handy to develop a series of scripts to backup, restore, create, move databases around. As of late, I&#8217;ve been working with SQL Server a lot so I&#8217;ve come to appreciate the sqlcmd utility. You can run the sqlcmd utility from the command line and run a input [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[23,3,4],"tags":[414,560,270,561,557,558,559],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p902K-n3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/1429"}],"collection":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/comments?post=1429"}],"version-history":[{"count":1,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/1429\/revisions"}],"predecessor-version":[{"id":1430,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/1429\/revisions\/1430"}],"wp:attachment":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/media?parent=1429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/categories?post=1429"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/tags?post=1429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}