SSMS 2008 Add-In - Execute Query

Posted by ca8msm on Stack Overflow See other posts from Stack Overflow or by ca8msm
Published on 2010-03-16T14:42:49Z Indexed on 2010/03/16 14:46 UTC
Read the original article Hit count: 643

Filed under:
|
|

I'm loading a sql script up to an SSMS 2008 add-in like so:

            ' create a new blank document
        ServiceCache.ScriptFactory.CreateNewBlankScript(Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptType.Sql)

        ' insert SQL statement to the blank document
        Dim doc As EnvDTE.TextDocument = CType(ServiceCache.ExtensibilityModel.Application.ActiveDocument.Object(Nothing), EnvDTE.TextDocument)
        doc.EndPoint.CreateEditPoint().Insert(_Output.ToString())

Is there a way to automatically execute the statement as well?

Thanks,
Mark

© Stack Overflow or respective owner

Related posts about SSMS

Related posts about ssms2008