sql-server – SSMS工具包替代
有没有可与 SSMS Tools Pack 2012相媲美的工具?许可证(每台机器30美元,任意数量的机器100美元…… 3个月)留下了很多不足之处,我不确定还有哪些其他选择. 例如,我真正想念的一件事是“保存您运行的每个查询”.在进行修补和研究时,在运行它们时运行备份不同版本的查询是非常宝贵的.或者当我意识到我没有备份我在2个月前工作的查询时. 澄清:SQL Server Management Studio没有官方的插件支持,但有一些工具. SSMS工具包是我非常喜欢的(2005年,2008年版本),但2012年的许可费用太可怕了. (我会支付合理的许可证,但这不是问题.) 我发现SSMS Boost例如对SSMS有一些很酷的补充,看起来值得. SQL Server 2012还有哪些其他插件?当我像SSMS工具包那样点击F5时,或者除了列出的两个工具之外还有什么东西,我喜欢有一些可以保存查询的东西吗? 解决方法我以为我会玩这个并且为了达到规定的目标,即在SQL Server 2012 SSMS上运行“保存您运行的每个查询”,这似乎可以在我的机器上完成工作(添加您自己的错误处理/测试/重构)它基于Andrei’s sample project而取代了Connect类. Codeplex上的SSMSAddin2012 project也非常有用. namespace SSMSAddin { using System; using System.IO; using System.Windows.Forms; using EnvDTE; using EnvDTE80; using Extensibility; using Microsoft.SqlServer.Management.UI.VSIntegration; public class Connect : IDTExtensibility2 { private DTE2 application; private CommandEvents executeSqlEvents; public void OnConnection(object application,ext_ConnectMode connectMode,object addInInst,ref Array custom) { this.application = (DTE2)application; this.executeSqlEvents = this.application.Events.CommandEvents["{52692960-56BC-4989-B5D3-94C47A513E8D}",1]; this.executeSqlEvents.BeforeExecute += this.executeSQLEvents_BeforeExecute; } private void executeSQLEvents_BeforeExecute(string guid,int id,object customin,object customout,ref bool canceldefault) { try { Document document = ((DTE2)ServiceCache.ExtensibilityModel).ActiveDocument; var textDocument = (TextDocument)document.Object("TextDocument"); string queryText = textDocument.Selection.Text; if(string.IsNullOrEmpty(queryText)) { EditPoint startPoint = textDocument.StartPoint.CreateEditPoint(); queryText = startPoint.GetText(textDocument.EndPoint); } DateTime now = DateTime.Now; string folderPath = string.Format(@"E:SSMS Queries{0}",now.ToString("yyyyMMdd")); string fileName = now.ToString("HHmmss-FFFFFFF") + ".sql"; Directory.CreateDirectory(folderPath); string fullPath = Path.Combine(folderPath,fileName); File.WriteAllText(fullPath,queryText); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } #region Other Interface Methods public void OnDisconnection(ext_DisconnectMode disconnectMode,ref Array custom) { } public void OnStartupComplete(ref Array custom) { } public void OnAddInsUpdate(ref Array custom) { } public void OnBeginShutdown(ref Array custom) { } #endregion } } (编辑:武汉站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |