{"id":1125,"date":"2012-11-12T13:00:43","date_gmt":"2012-11-12T11:00:43","guid":{"rendered":"http:\/\/hen.co.za\/blog\/?p=1125"},"modified":"2012-11-12T13:00:43","modified_gmt":"2012-11-12T11:00:43","slug":"createsqldbhelper-tool-to-create-and-set-up-database-from-scripts","status":"publish","type":"post","link":"https:\/\/hen.co.za\/blog\/2012\/11\/createsqldbhelper-tool-to-create-and-set-up-database-from-scripts\/","title":{"rendered":"CreateSqlDBHelper &#8211; Tool to create and set up database from scripts"},"content":{"rendered":"<p>I&#8217;ve done it again. re-invented the wheel&#8230; uhm, no. But I did create a tool to create and set up a new sql server database from scripts that can be launched from the command line. This could be useful if you must automate the process of setting up a test database each time you need to run a new set of tests.<\/p>\n<p>It works like this (coomand line options)<\/p>\n<p>Usage: CreateSqlDBHelper.exe &lt;server&gt; &lt;database&gt; &lt;data files path&gt; &lt;-d&gt; &lt;script1.sql [script2.sql &#8230;]&gt;<br \/>\nWhere<br \/>\n-d : drop database first<\/p>\n<p>This allows you to specify a sql server\/instance name, database name, path where the database files will be located plus any number of sql script files that needs to be run to set up a new database. Typically you&#8217;ll start by running scripts that will create tables, views, sprocs and also initial data rows etc. Optionally the tool can first &#8216;drop&#8217; the existing database (but for now that requires a manual press &#8216;Y&#8217; step). It makes use of the .Net 4.0 client framework plus SQL server SMO libraries &#8211; which come with SQL server&#8230;<\/p>\n<p>You can find a copy of the tool <a title=\"CreateSqlDBHelper.zip\" href=\"https:\/\/dl.dropbox.com\/u\/20983\/CreateSqlDBHelper.zip\" target=\"_blank\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve done it again. re-invented the wheel&#8230; uhm, no. But I did create a tool to create and set up a new sql server database from scripts that can be launched from the command line. This could be useful if &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/hen.co.za\/blog\/2012\/11\/createsqldbhelper-tool-to-create-and-set-up-database-from-scripts\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[37,303,255,245,49,41],"class_list":["post-1125","post","type-post","status-publish","format-standard","hentry","category-development","category-projects","tag-database","tag-development","tag-scripts","tag-server","tag-sql","tag-tool"],"_links":{"self":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/comments?post=1125"}],"version-history":[{"count":2,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1125\/revisions"}],"predecessor-version":[{"id":1127,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1125\/revisions\/1127"}],"wp:attachment":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/media?parent=1125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/categories?post=1125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/tags?post=1125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}