{"id":2724,"date":"2013-08-29T14:33:43","date_gmt":"2013-08-29T14:33:43","guid":{"rendered":"http:\/\/www.withdata.com\/ad\/?p=2724"},"modified":"2013-08-29T14:33:43","modified_gmt":"2013-08-29T14:33:43","slug":"how-to-execute-sql-file-at-sql-server-command-line","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/sql-server\/how-to-execute-sql-file-at-sql-server-command-line.html","title":{"rendered":"How to execute sql file at SQL Server command line"},"content":{"rendered":"<p>You can use\u00a0<strong>sqlcmd\u00a0<\/strong>to run a Transact-SQL script file. A Transact-SQL script file is a text file that can contain a combination of Transact-SQL statements,\u00a0sqlcmdcommands, and scripting variables.<\/p>\n<p>To run the script file<br \/>\n1.Open a command prompt window.<br \/>\n2.In the Command Prompt window, type:<\/p>\n<pre>sqlcmd -S myServer\\instanceName -i C:\\myScript.sql<\/pre>\n<p>3.Press ENTER.<\/p>\n<p>More information, see\u00a0<a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/ms170572.aspx\">http:\/\/technet.microsoft.com\/en-us\/library\/ms170572.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use\u00a0sqlcmd\u00a0to run a Transact-SQL script file. A Transact-SQL script file is a text file that can contain a combination of Transact-SQL statements,\u00a0sqlcmdcommands, and scripting variables. To run the script file 1.Open a command prompt window. 2.In the Command Prompt window, type: sqlcmd -S myServer\\instanceName -i C:\\myScript.sql 3.Press ENTER. More information, see\u00a0http:\/\/technet.microsoft.com\/en-us\/library\/ms170572.aspx<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[73,463,1321],"class_list":["post-2724","post","type-post","status-publish","format-standard","hentry","category-sql-server","tag-command-line","tag-command-line-execute-sql","tag-sql-server"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=2724"}],"version-history":[{"count":1,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2724\/revisions"}],"predecessor-version":[{"id":2725,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/2724\/revisions\/2725"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=2724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=2724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=2724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}