executing queries from ado.net like I do from sql management studio
I am developing a small utility for my team which I want to use while deploying a database release. The developers are using management studio and whenever they make changes in an SP or table, they are creating scripts from management studio (DROP and CREATE) option.
In my utility, I use that script a开发者_如何学Cnd when I run that script with ADO.Net execute non query, it throws several exceptions like - 'GO' is not correct keyword etc.
Can anyone please suggest what could be a way to run those scripts as is?
Thanks
Use of the Microsoft tools to run these scripts - they understand the GO
command (which is not SQL) and strip it out before sending to SQL Server.
See sqlcmd and the older (deprecated) osql utilities.
精彩评论