Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Execute SQL in Powershell

Author  Topic 

leo_corona
Starting Member

1 Post

Posted - 2012-08-08 : 11:49:05
I created a simple table.sql in notepad++. I want to execute it on powershell to create a .db file. How do I do that? In Linux, the command seems to be sqlite3 table.db < table.sql, but the redirection doesn't work in Powershell. Please help!

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-08-08 : 12:16:09
You can use Invoke-SqlCmd or sqlcmd directly with -InputFile option or -i options, respectively. There are examples here:

http://technet.microsoft.com/en-us/library/cc281720.aspx
http://msdn.microsoft.com/en-us/library/ms162773.aspx
Go to Top of Page
   

- Advertisement -