├── .gitignore
├── LICENSE
├── README.md
├── SSMSExecutor.Setup
├── .gitignore
├── Output
│ └── .gitignore
├── Setup.iss
├── Temp
│ └── .gitignore
├── build.cmd
└── build_files.rsp
├── SSMSExecutor.sln
└── SSMSExecutor
├── ExecuteCommand.cs
├── Executor.cs
├── ExecutorPackage.cs
├── ExecutorPackage.vsct
├── Helpers.cs
├── Key.snk
├── Options
└── GeneralOptionsPage.cs
├── Properties
├── AssemblyInfo.cs
├── Settings.Designer.cs
└── Settings.settings
├── Resources
├── Command1Package.ico
├── ExecutorCommand.png
└── license.txt
├── SSMSExecutor.csproj
├── VSPackage.resx
├── app.config
├── packages.config
└── source.extension.vsixmanifest
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Stanislav Stoyanov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SSMS Executor
2 |
3 | SQL Server Management Studio (SSMS) extension for executing the current statement based on the cursor position.
4 |
5 | If your script contains multiple statements, position the cursor within the desired statement and press `ctrl+shift+e` to execute it.
6 |
7 | # Documentation
8 |
9 | [Getting started guide](https://github.com/devvcat/ssms-executor/wiki)
10 |
11 | [Known issues with workarounds](https://github.com/devvcat/ssms-executor/wiki/Known-issues)
12 |
13 | [Release notes for released versions and daily builds](https://github.com/devvcat/ssms-executor/wiki/Release-notes)
14 |
15 | # Downloads/builds
16 |
17 | ## SQL Server Management Studio (SSMS) 16.x, 17.x and 18.x Extension
18 |
19 | You can download the extension from the [Releases section](https://github.com/devvcat/ssms-executor/releases)
20 |
21 |
22 | ## SQL Server Management Studio (SSMS) 2012 AddIn
23 |
24 | You can download the addin from the [Releases section](https://github.com/devvcat/ssms-executor/releases)
25 |
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/Output/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/Setup.iss:
--------------------------------------------------------------------------------
1 | #ifndef AppVersion
2 | #define AppVersion '2.0.x-alpha'
3 | #endif
4 |
5 | #define SrcDir 'Temp\SSMSExecutor'
6 | #define SsmsOutDir 'SSMSExecutor'
7 | #define SsmsPackageGuid '{{a64d9865-b938-4543-bf8f-a553cc4f67f3}'
8 |
9 |
10 | [Setup]
11 | AppName=SSMS Executor
12 | AppVersion={#AppVersion}
13 | DefaultDirName={pf}\{#SsmsOutDir}
14 | DisableProgramGroupPage=yes
15 | SourceDir={#SrcDir}
16 | OutputDir=Output
17 | OutputBaseFilename=SSMSExecutor-{#AppVersion}
18 |
19 | AllowNoIcons=yes
20 | Compression=lzma2
21 | SolidCompression=yes
22 |
23 | PrivilegesRequired=admin
24 | DisableReadyPage=yes
25 | DisableReadyMemo=yes
26 |
27 | [Files]
28 | Source: "SSMSExecutor.dll"; DestDir: "{app}"
29 | Source: "SSMSExecutor.dll.config"; DestDir: "{app}"
30 | Source: "Microsoft.SqlServer.TransactSql.ScriptDom.dll"; DestDir: "{app}"
31 | Source: "Resources\Command1Package.ico"; DestDir: "{app}\Resources"
32 | Source: "Resources\license.txt"; DestDir: "{app}\Resources"
33 |
34 | Source: "SSMSExecutor.pkgdef"; DestDir: "{code:GetOutputDir|2014}"; Check: CanInstall(2014);
35 | Source: "SSMSExecutor.pkgdef"; DestDir: "{code:GetOutputDir|2016}"; Check: CanInstall(2016);
36 | Source: "SSMSExecutor.pkgdef"; DestDir: "{code:GetOutputDir|2017}"; Check: CanInstall(2017);
37 | Source: "SSMSExecutor.pkgdef"; DestDir: "{code:GetOutputDir|2019}"; Check: CanInstall(2019);
38 |
39 | Source: "extension.vsixmanifest"; DestDir: "{code:GetOutputDir|2014}"; Check: CanInstall(2014);
40 | Source: "extension.vsixmanifest"; DestDir: "{code:GetOutputDir|2016}"; Check: CanInstall(2016);
41 | Source: "extension.vsixmanifest"; DestDir: "{code:GetOutputDir|2017}"; Check: CanInstall(2017);
42 | Source: "extension.vsixmanifest"; DestDir: "{code:GetOutputDir|2019}"; Check: CanInstall(2019);
43 |
44 | [Ini]
45 | Filename: "{code:GetOutputDir|2014}\SSMSExecutor.pkgdef"; Check: CanInstall(2014); Section: "$RootKey$\Packages\{#SsmsPackageGuid}"; Key: """CodeBase"""; String: """{app}\SSMSExecutor.dll""";
46 | Filename: "{code:GetOutputDir|2016}\SSMSExecutor.pkgdef"; Check: CanInstall(2016); Section: "$RootKey$\Packages\{#SsmsPackageGuid}"; Key: """CodeBase"""; String: """{app}\SSMSExecutor.dll""";
47 | Filename: "{code:GetOutputDir|2017}\SSMSExecutor.pkgdef"; Check: CanInstall(2017); Section: "$RootKey$\Packages\{#SsmsPackageGuid}"; Key: """CodeBase"""; String: """{app}\SSMSExecutor.dll""";
48 | Filename: "{code:GetOutputDir|2019}\SSMSExecutor.pkgdef"; Check: CanInstall(2019); Section: "$RootKey$\Packages\{#SsmsPackageGuid}"; Key: """CodeBase"""; String: """{app}\SSMSExecutor.dll""";
49 |
50 | [Registry]
51 | Root: HKCU; Subkey: "{code:GetRegistryKey|2014}"; ValueType: dword; ValueName: "SkipLoading"; ValueData: 1; Check: CanInstall(2014);
52 | Root: HKCU; Subkey: "{code:GetRegistryKey|2016}"; ValueType: dword; ValueName: "SkipLoading"; ValueData: 1; Check: CanInstall(2016);
53 | Root: HKCU; Subkey: "{code:GetRegistryKey|2017}"; ValueType: dword; ValueName: "SkipLoading"; ValueData: 1; Check: CanInstall(2017);
54 |
55 | [Code]
56 | const
57 | SSMS_2019 = 2019;
58 | SSMS_2017 = 2017;
59 | SSMS_2016 = 2016;
60 | SSMS_2014 = 2014;
61 |
62 | SSMS_HKEY = 'Software\Microsoft\SQL Server Management Studio\%s';
63 | SSMS_HKEY_CONFIG = SSMS_HKEY + '_Config';
64 |
65 |
66 | type
67 | TSsms = record
68 | Version: Word;
69 | InternalVersion: String;
70 | InstallDir: String;
71 | ExtensionsDir: String;
72 | end;
73 |
74 | TSsmsArr = array of TSsms;
75 |
76 | var
77 | SsmsOptionPage: TInputOptionWizardPage;
78 | Ssms: TSsmsArr;
79 |
80 |
81 | function GetSsmsInternalVersion(Version: Integer): String;
82 | begin
83 | Result:= '';
84 | if Version = SSMS_2014 then Result:= '12.0'
85 | else if Version = SSMS_2016 then Result:= '13.0'
86 | else if Version = SSMS_2017 then Result:= '14.0'
87 | else if Version = SSMS_2019 then Result:= '18.0_IsoShell';
88 | end;
89 |
90 | function GetSsmsInstallDir(const InternalVersion: String; var InstallDir: String): Boolean;
91 | var
92 | SubKeyName: String;
93 | T: String;
94 | begin
95 | Result:= False;
96 | SubKeyName:= Format(SSMS_HKEY_CONFIG, [InternalVersion]);
97 |
98 | if RegQueryStringValue(HKEY_CURRENT_USER, SubKeyName, 'InstallDir', InstallDir) then
99 | begin
100 | if (InternalVersion = '18.0_IsoShell') then
101 | begin
102 | InstallDir := InstallDir + '\Common7\IDE';
103 | end;
104 |
105 | if FileExists(InstallDir + '\Ssms.exe') then
106 | begin
107 | Result:= True;
108 | end
109 | end
110 | end;
111 |
112 | function GetSsmsExtensionsDir(const InternalVersion: String; const InstallDir: String): String;
113 | var
114 | SubKeyName: String;
115 | ExtensionsDir: String;
116 | begin
117 | SubKeyName:= Format(SSMS_HKEY_CONFIG + '\Initialization', [InternalVersion]);
118 |
119 | if not RegQueryStringValue(
120 | HKEY_CURRENT_USER, SubKeyName, 'ApplicationExtensionsFolder', ExtensionsDir) then
121 | begin
122 | ExtensionsDir:= InstallDir + '\Extensions';
123 | end;
124 |
125 | Result:= ExtensionsDir;
126 | end;
127 |
128 | function GetOutputDir(const Version: String): String;
129 | var
130 | I: Integer;
131 | begin
132 | Result:= '';
133 |
134 | for I:= Low(Ssms) to High(Ssms) do begin
135 | if SsmsOptionPage.Values[I] then
136 | begin
137 | if Ssms[I].Version = StrToInt(Version) then
138 | begin
139 | Result:= Ssms[I].ExtensionsDir + '\SSMSExecutor';
140 | Break;
141 | end
142 | end
143 | end
144 | end;
145 |
146 | function GetRegistryKey(const Version: String): String;
147 | var
148 | InternalVersion: String;
149 | begin
150 | InternalVersion:= GetSsmsInternalVersion(StrToInt(Version));
151 | Result:= Format(SSMS_HKEY + '\Packages\%s', [InternalVersion, ExpandConstant('{#SsmsPackageGuid}')]);
152 | end;
153 |
154 | function CanInstall(Version: Integer): Boolean;
155 | var
156 | I: Integer;
157 | begin
158 | Result:= False;
159 |
160 | for I:= Low(Ssms) to High(Ssms) do begin
161 | if SsmsOptionPage.Values[I] then
162 | begin
163 | if Ssms[I].Version = Version then
164 | begin
165 | Result:= True;
166 | Break;
167 | end
168 | end
169 | end
170 | end;
171 |
172 | function InitializeSetup(): Boolean;
173 | var
174 | I, Len: Word;
175 | SsmsArr: array of Word;
176 | InstallDir, Version, InternalVersion: String;
177 | begin
178 | Result:= True;
179 |
180 | SsmsArr:= [
181 | SSMS_2014,
182 | SSMS_2016,
183 | SSMS_2017,
184 | SSMS_2019
185 | ];
186 |
187 | // Loop through all supported SSMS versions
188 | for I:= Low(SsmsArr) to High(SsmsArr) do
189 | begin
190 | InternalVersion:= GetSsmsInternalVersion(SsmsArr[I]);
191 |
192 | // Check if SSMS is actually installed
193 | if GetSsmsInstallDir(InternalVersion, InstallDir) then
194 | begin
195 | Len:= Length(Ssms);
196 | SetLength(Ssms, Len + 1);
197 |
198 | // SSMS istalled, add it to the available list
199 | Ssms[Len].Version := SsmsArr[I];
200 | Ssms[Len].InternalVersion := InternalVersion;
201 | Ssms[Len].InstallDir := InstallDir;
202 | Ssms[Len].ExtensionsDir := GetSsmsExtensionsDir(InternalVersion, InstallDir);
203 | end
204 | end;
205 |
206 | if Length(Ssms) = 0 then
207 | begin
208 | MsgBox('SQL Server Management Studio not installed.', mbCriticalError, mb_Ok);
209 | Result:= False;
210 | end
211 | end;
212 |
213 | procedure InitializeWizard();
214 | var
215 | LabelText: String;
216 | Idx: Integer;
217 | begin
218 | SsmsOptionPage:= CreateInputOptionPage(wpWelcome,
219 | 'Features', 'Select features to install',
220 | 'Please select features to be installed',
221 | False, False);
222 |
223 | for Idx:= Low(Ssms) to High(Ssms) do
224 | begin
225 | LabelText:= Format('SQL Server Management Studio %d Extension', [Ssms[Idx].Version]);
226 | SsmsOptionPage.Add(LabelText);
227 | SsmsOptionPage.Values[Idx]:= Idx = High(Ssms);
228 | end
229 | end;
230 |
231 | function NextButtonClick(CurPageID: Integer): Boolean;
232 | var
233 | SelectedFeatures, I: Integer;
234 | begin
235 | Result:= True;
236 |
237 | if CurPageID = 100 then
238 | begin
239 | for I:= Low(Ssms) to High(Ssms) do
240 | begin
241 | if SsmsOptionPage.Values[I] then Inc(SelectedFeatures);
242 | end;
243 |
244 | if SelectedFeatures = 0 then
245 | begin
246 | MsgBox('Please select at least one SSMS version', mbInformation, MB_OK);
247 | Result:= False;
248 | end
249 | end
250 | end;
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/Temp/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/build.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 |
4 | set APP_VERSION=2.0.3-alpha
5 | set VS_VERSION=2017
6 | set VS_PRODUCT=Community
7 | set VS_DEVCMD=C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\%VS_PRODUCT%\Common7\Tools
8 | set OUT_DIR=%CD%\Temp\SSMSExecutor
9 | set INNO_COMPILER_DIR=C:\Program Files (x86)\Inno Setup 5
10 | set ZIP_DIR=C:\Program Files\7-Zip
11 |
12 | set PATH=%PATH%;%ZIP_DIR%
13 | set PATH=%PATH%;%INNO_COMPILER_DIR%
14 |
15 | rmdir /S /Q %OUT_DIR%
16 | del Temp\*.rsp
17 |
18 | pushd %VS_DEVCMD%
19 | call VsDevCmd.bat
20 | popd
21 | cls
22 |
23 | msbuild /target:Clean,Rebuild /p:Configuration=Release,OutDir=%OUT_DIR% /nologo /ds ..\SSMSExecutor\SSMSExecutor.csproj
24 | copy build_files.rsp Temp\
25 |
26 | call ISCC.exe /O"Output\" /Qp /DAppVersion=%APP_VERSION% Setup.iss
27 |
28 | pushd Temp
29 | call 7z.exe a -bt -bb3 SSMSExecutor-%APP_VERSION%.zip @build_files.rsp
30 | move SSMSExecutor-%APP_VERSION%.zip ..\Output
31 | popd
32 |
33 | endlocal
34 | @echo on
--------------------------------------------------------------------------------
/SSMSExecutor.Setup/build_files.rsp:
--------------------------------------------------------------------------------
1 | SSMSExecutor\SSMSExecutor.dll
2 | SSMSExecutor\SSMSExecutor.dll.config
3 | SSMSExecutor\SSMSExecutor.pkgdef
4 | SSMSExecutor\extension.vsixmanifest
5 | SSMSExecutor\Microsoft.SqlServer.TransactSql.ScriptDom.dll
6 | SSMSExecutor\Resources\license.txt
7 | SSMSExecutor\Resources\Command1Package.ico
--------------------------------------------------------------------------------
/SSMSExecutor.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27004.2009
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SSMSExecutor", "SSMSExecutor\SSMSExecutor.csproj", "{B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | VS-Debug|Any CPU = VS-Debug|Any CPU
13 | EndGlobalSection
14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
17 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
18 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.Release|Any CPU.Build.0 = Release|Any CPU
19 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.VS-Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}.VS-Debug|Any CPU.Build.0 = Debug|Any CPU
21 | EndGlobalSection
22 | GlobalSection(SolutionProperties) = preSolution
23 | HideSolutionNode = FALSE
24 | EndGlobalSection
25 | GlobalSection(ExtensibilityGlobals) = postSolution
26 | SolutionGuid = {4911DE89-F952-4AC0-91EC-ED6377F69A86}
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/SSMSExecutor/ExecuteCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 |
4 | using EnvDTE;
5 | using EnvDTE80;
6 | using Microsoft.VisualStudio.Shell;
7 |
8 | namespace Devvcat.SSMS
9 | {
10 | ///
11 | /// Command handler
12 | ///
13 | sealed class ExecutorCommand
14 | {
15 | public const int ExecuteStatementCommandId = 0x0100;
16 | public const int ExecuteInnerStatementCommandId = 0x0101;
17 |
18 | public static readonly Guid CommandSet = new Guid("746c2fb4-20a2-4d26-b95d-f8db97c16875");
19 |
20 | readonly Package package;
21 | readonly DTE2 dte;
22 |
23 | private ExecutorCommand(Package package)
24 | {
25 | this.package = package ?? throw new ArgumentNullException(nameof(package));
26 | this.dte = (DTE2)ServiceProvider.GetService(typeof(DTE));
27 |
28 | if (ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
29 | {
30 | CommandID menuCommandID;
31 | OleMenuCommand menuCommand;
32 |
33 | // Create execute current statement menu item
34 | menuCommandID = new CommandID(CommandSet, ExecuteStatementCommandId);
35 | menuCommand = new OleMenuCommand(Command_Exec, menuCommandID);
36 | menuCommand.BeforeQueryStatus += Command_QueryStatus;
37 | commandService.AddCommand(menuCommand);
38 |
39 | // Create execute inner satetement menu item
40 | menuCommandID = new CommandID(CommandSet, ExecuteInnerStatementCommandId);
41 | menuCommand = new OleMenuCommand(Command_Exec, menuCommandID);
42 | menuCommand.BeforeQueryStatus += Command_QueryStatus;
43 | commandService.AddCommand(menuCommand);
44 | }
45 | }
46 |
47 | private IServiceProvider ServiceProvider => package;
48 |
49 | public static ExecutorCommand Instance
50 | {
51 | get;
52 | private set;
53 | }
54 |
55 | public static void Initialize(Package package)
56 | {
57 | Instance = new ExecutorCommand(package);
58 | }
59 |
60 | private Executor.ExecScope GetScope(int commandId)
61 | {
62 | var scope = Executor.ExecScope.Block;
63 | if (commandId == ExecuteInnerStatementCommandId)
64 | {
65 | scope = Executor.ExecScope.Inner;
66 | }
67 | return scope;
68 | }
69 |
70 | private void Command_QueryStatus(object sender, EventArgs e)
71 | {
72 | if (sender is OleMenuCommand menuCommand)
73 | {
74 | menuCommand.Enabled = false;
75 | menuCommand.Supported = false;
76 |
77 | if (dte.HasActiveDocument())
78 | {
79 | menuCommand.Enabled = dte.ActiveWindow.HWnd == dte.ActiveDocument.ActiveWindow.HWnd;
80 | menuCommand.Supported = true;
81 | }
82 | }
83 | }
84 |
85 | private void Command_Exec(object sender, EventArgs e)
86 | {
87 | if (sender is OleMenuCommand menuCommand)
88 | {
89 | var executor = new Executor(dte);
90 | var scope = GetScope(menuCommand.CommandID.ID);
91 |
92 | executor.ExecuteStatement(scope);
93 | }
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/SSMSExecutor/Executor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using EnvDTE;
5 | using EnvDTE80;
6 | using Microsoft.SqlServer.TransactSql.ScriptDom;
7 |
8 | namespace Devvcat.SSMS
9 | {
10 | sealed class Executor
11 | {
12 | public readonly string CMD_QUERY_EXECUTE = "Query.Execute";
13 |
14 | private Document document;
15 |
16 | private EditPoint oldAnchor;
17 | private EditPoint oldActivePoint;
18 |
19 | public Executor(DTE2 dte)
20 | {
21 | if (dte == null) throw new ArgumentNullException(nameof(dte));
22 |
23 | document = dte.GetDocument();
24 |
25 | SaveActiveAndAnchorPoints();
26 | }
27 |
28 | private VirtualPoint GetCaretPoint()
29 | {
30 | var p = ((TextSelection)document.Selection).ActivePoint;
31 |
32 | return new VirtualPoint(p);
33 | }
34 |
35 | private string GetDocumentText()
36 | {
37 | var content = string.Empty;
38 | var selection = (TextSelection)document.Selection;
39 |
40 | if (!selection.IsEmpty)
41 | {
42 | content = selection.Text;
43 | }
44 | else
45 | {
46 | if (document.Object("TextDocument") is TextDocument doc)
47 | {
48 | content = doc.StartPoint.CreateEditPoint().GetText(doc.EndPoint);
49 | }
50 | }
51 |
52 | return content;
53 | }
54 |
55 | private void SaveActiveAndAnchorPoints()
56 | {
57 | var selection = (TextSelection)document.Selection;
58 |
59 | oldAnchor = selection.AnchorPoint.CreateEditPoint();
60 | oldActivePoint = selection.ActivePoint.CreateEditPoint();
61 | }
62 |
63 | private void RestoreActiveAndAnchorPoints()
64 | {
65 | var startPoint = new VirtualPoint(oldAnchor);
66 | var endPoint = new VirtualPoint(oldActivePoint);
67 |
68 | MakeSelection(startPoint, endPoint);
69 | }
70 |
71 | private void MakeSelection(VirtualPoint startPoint, VirtualPoint endPoint)
72 | {
73 | var selection = (TextSelection)document.Selection;
74 |
75 | selection.MoveToLineAndOffset(startPoint.Line, startPoint.LineCharOffset);
76 | selection.SwapAnchor();
77 | selection.MoveToLineAndOffset(endPoint.Line, endPoint.LineCharOffset, true);
78 | }
79 |
80 | private bool ParseSqlFragments(string script, out TSqlScript sqlFragments)
81 | {
82 | IList errors;
83 | TSql140Parser parser = new TSql140Parser(true);
84 |
85 | using (System.IO.StringReader reader = new System.IO.StringReader(script))
86 | {
87 | sqlFragments = parser.Parse(reader, out errors) as TSqlScript;
88 | }
89 |
90 | return errors.Count == 0;
91 | }
92 |
93 | private IList GetInnerStatements(TSqlStatement statement)
94 | {
95 | List list = new List();
96 |
97 | if (statement is BeginEndBlockStatement block)
98 | {
99 | list.AddRange(block.StatementList.Statements);
100 | }
101 | else if (statement is IfStatement ifBlock)
102 | {
103 | if (ifBlock.ThenStatement != null)
104 | {
105 | list.Add(ifBlock.ThenStatement);
106 | }
107 | if (ifBlock.ElseStatement != null)
108 | {
109 | list.Add(ifBlock.ElseStatement);
110 | }
111 | }
112 | else if (statement is WhileStatement whileBlock)
113 | {
114 | list.Add(whileBlock.Statement);
115 | }
116 |
117 | return list;
118 | }
119 |
120 | private bool IsCaretInsideStatement(TSqlStatement statement, VirtualPoint caret)
121 | {
122 | var ft = statement.ScriptTokenStream[statement.FirstTokenIndex];
123 | var lt = statement.ScriptTokenStream[statement.LastTokenIndex];
124 |
125 | if (caret.Line >= ft.Line && caret.Line <= lt.Line)
126 | {
127 | var isBeforeFirstToken = caret.Line == ft.Line && caret.LineCharOffset < ft.Column;
128 | var isAfterLastToken = caret.Line == lt.Line && caret.LineCharOffset > lt.Column + lt.Text.Length;
129 |
130 | if (!(isBeforeFirstToken || isAfterLastToken))
131 | {
132 | return true;
133 | }
134 | }
135 |
136 | return false;
137 | }
138 |
139 | private TextBlock GetTextBlockFromStatement(TSqlStatement statement)
140 | {
141 | var ft = statement.ScriptTokenStream[statement.FirstTokenIndex];
142 | var lt = statement.ScriptTokenStream[statement.LastTokenIndex];
143 |
144 | return new TextBlock()
145 | {
146 | StartPoint = new VirtualPoint
147 | {
148 | Line = ft.Line,
149 | LineCharOffset = ft.Column
150 | },
151 |
152 | EndPoint = new VirtualPoint
153 | {
154 | Line = lt.Line,
155 | LineCharOffset = lt.Column + lt.Text.Length
156 | }
157 | };
158 | }
159 |
160 | private TextBlock FindCurrentStatement(IList statements, VirtualPoint caret, ExecScope scope)
161 | {
162 | if (statements == null || statements.Count == 0)
163 | {
164 | return null;
165 | }
166 |
167 | foreach (var statement in statements)
168 | {
169 | if (scope == ExecScope.Inner)
170 | {
171 | IList statementList = GetInnerStatements(statement);
172 |
173 | TextBlock currentStatement = FindCurrentStatement(statementList, caret, scope);
174 |
175 | if (currentStatement != null)
176 | {
177 | return currentStatement;
178 | }
179 | }
180 |
181 | if (IsCaretInsideStatement(statement, caret))
182 | {
183 | return GetTextBlockFromStatement(statement);
184 | }
185 | }
186 |
187 | return null;
188 | }
189 |
190 | private void Exec()
191 | {
192 | document.DTE.ExecuteCommand(CMD_QUERY_EXECUTE);
193 | }
194 |
195 | private bool CanExecute()
196 | {
197 | try
198 | {
199 | var cmd = document.DTE.Commands.Item(CMD_QUERY_EXECUTE, -1);
200 | return cmd.IsAvailable;
201 | }
202 | catch
203 | { }
204 |
205 | return false;
206 | }
207 |
208 | public void ExecuteStatement(ExecScope scope = ExecScope.Block)
209 | {
210 | if (!CanExecute())
211 | {
212 | return;
213 | }
214 |
215 | SaveActiveAndAnchorPoints();
216 |
217 | if (!(document.Selection as TextSelection).IsEmpty)
218 | {
219 | Exec();
220 | }
221 | else
222 | {
223 | var script = GetDocumentText();
224 | var caretPoint = GetCaretPoint();
225 |
226 | bool success = ParseSqlFragments(script, out TSqlScript sqlScript);
227 |
228 | if (success)
229 | {
230 | TextBlock currentStatement = null;
231 |
232 | foreach (var batch in sqlScript?.Batches)
233 | {
234 | currentStatement = FindCurrentStatement(batch.Statements, caretPoint, scope);
235 |
236 | if (currentStatement != null)
237 | {
238 | break;
239 | }
240 | }
241 |
242 | if (currentStatement != null)
243 | {
244 | // select the statement to be executed
245 | MakeSelection(currentStatement.StartPoint, currentStatement.EndPoint);
246 |
247 | // execute the statement
248 | Exec();
249 |
250 | // restore selection
251 | RestoreActiveAndAnchorPoints();
252 | }
253 | }
254 | else
255 | {
256 | // there are syntax errors
257 | // execute anyway to show the errors
258 | Exec();
259 | }
260 | }
261 | }
262 |
263 | public class VirtualPoint
264 | {
265 | public int Line { get; set; }
266 | public int LineCharOffset { get; set; }
267 |
268 | public VirtualPoint()
269 | {
270 | Line = 1;
271 | LineCharOffset = 0;
272 | }
273 |
274 | public VirtualPoint(EnvDTE.TextPoint point)
275 | {
276 | Line = point.Line;
277 | LineCharOffset = point.LineCharOffset;
278 | }
279 | }
280 |
281 | public class TextBlock
282 | {
283 | public VirtualPoint StartPoint { get; set; }
284 | public VirtualPoint EndPoint { get; set; }
285 | }
286 |
287 | internal enum ExecScope
288 | {
289 | Block,
290 | Inner
291 | }
292 | }
293 | }
294 |
--------------------------------------------------------------------------------
/SSMSExecutor/ExecutorPackage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Diagnostics;
4 | using System.Diagnostics.CodeAnalysis;
5 | using System.Globalization;
6 | using System.Text.RegularExpressions;
7 | using System.Runtime.InteropServices;
8 | using Microsoft.VisualStudio;
9 | using Microsoft.VisualStudio.Shell;
10 | using Microsoft.VisualStudio.Shell.Interop;
11 | using Microsoft.Win32;
12 | using Devvcat.SSMS.Options;
13 |
14 | namespace Devvcat.SSMS
15 | {
16 | [PackageRegistration(UseManagedResourcesOnly = true)]
17 | [InstalledProductRegistration("#110", "#112", "2.0.2", IconResourceID = 400)] // Info on this package for Help/About
18 | [ProvideMenuResource("Menus.ctmenu", 1)]
19 | [ProvideAutoLoad(VSConstants.UICONTEXT.ShellInitialized_string)]
20 | #if DEBUG
21 | [ProvideOptionPage(typeof(GeneralOptionsPage), "SSMS Executor", "General", 100, 101, true)]
22 | #endif
23 | [Guid(PackageGuidString)]
24 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
25 | public sealed class ExecutorPackage : Package
26 | {
27 | private const string PackageGuidString = "a64d9865-b938-4543-bf8f-a553cc4f67f3";
28 |
29 | public ExecutorPackage()
30 | {
31 | }
32 |
33 | protected override void Initialize()
34 | {
35 | base.Initialize();
36 |
37 | ExecutorCommand.Initialize(this);
38 | }
39 |
40 | protected override int QueryClose(out bool canClose)
41 | {
42 | SetSkipLoading();
43 |
44 | return base.QueryClose(out canClose);
45 | }
46 |
47 | void SetSkipLoading()
48 | {
49 | try
50 | {
51 | var registryKey = UserRegistryRoot.CreateSubKey(
52 | string.Format("Packages\\{{{0}}}", PackageGuidString));
53 |
54 | registryKey.SetValue("SkipLoading", 1, RegistryValueKind.DWord);
55 | registryKey.Close();
56 | }
57 | catch
58 | { }
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/SSMSExecutor/ExecutorPackage.vsct:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
19 |
20 |
21 |
22 |
32 |
33 |
43 |
44 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/SSMSExecutor/Helpers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using EnvDTE80;
7 |
8 | namespace Devvcat.SSMS
9 | {
10 | static class Helpers
11 | {
12 | public static bool HasActiveDocument(this DTE2 dte)
13 | {
14 | if (dte != null && dte.ActiveDocument != null)
15 | {
16 | var doc = (dte.ActiveDocument.DTE)?.ActiveDocument;
17 | return doc != null;
18 | }
19 |
20 | return false;
21 | }
22 |
23 | public static EnvDTE.Document GetDocument(this DTE2 dte)
24 | {
25 | if (dte.HasActiveDocument())
26 | {
27 | return (dte.ActiveDocument.DTE)?.ActiveDocument;
28 | }
29 |
30 | return null;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/SSMSExecutor/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devvcat/ssms-executor/f3823fd73d7e524620c4e4065a5a69d57ab472d9/SSMSExecutor/Key.snk
--------------------------------------------------------------------------------
/SSMSExecutor/Options/GeneralOptionsPage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.VisualStudio.Shell;
7 | using System.ComponentModel;
8 | using System.Runtime.InteropServices;
9 |
10 | namespace Devvcat.SSMS.Options
11 | {
12 | [Guid("5F238789-E306-48AE-93D6-44FCC2EAAC80")]
13 | internal class GeneralOptionsPage : DialogPage
14 | {
15 | [Category("Execute Options")]
16 | [DisplayName("Execute inner statements")]
17 | [Description("Execute inner statements instead of block")]
18 | [DefaultValue(false)]
19 | public bool ExecuteInnerStatements { get; set; }
20 |
21 | protected override void OnActivate(CancelEventArgs e)
22 | {
23 | ExecuteInnerStatements = Properties.Settings.Default.ExecuteInnerStatements;
24 |
25 | base.OnActivate(e);
26 | }
27 |
28 | protected override void OnApply(PageApplyEventArgs e)
29 | {
30 | Properties.Settings.Default.ExecuteInnerStatements = ExecuteInnerStatements;
31 | Properties.Settings.Default.Save();
32 |
33 | base.OnApply(e);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SSMSExecutor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SSMS Executor")]
9 | [assembly: AssemblyDescription("SQL Server Management Studio Add-in")]
10 | [assembly: AssemblyProduct("SSMS Executor")]
11 | [assembly: AssemblyCopyright("")]
12 | [assembly: AssemblyFileVersion("2.0.0.0")]
13 | [assembly: AssemblyInformationalVersion("2.0-alpha1")]
14 |
15 | // Setting ComVisible to false makes the types in this assembly not visible
16 | // to COM components. If you need to access a type in this assembly from
17 | // COM, set the ComVisible attribute to true on that type.
18 | [assembly: ComVisible(false)]
19 |
20 | // Version information for an assembly consists of the following four values:
21 | //
22 | // Major Version
23 | // Minor Version
24 | // Build Number
25 | // Revision
26 | //
27 | // You can specify all the values or you can default the Build and Revision Numbers
28 | // by using the '*' as shown below:
29 | // [assembly: AssemblyVersion("1.0.*")]
30 | [assembly: AssemblyVersion("2.0.3.*")]
31 | [assembly: AssemblyTrademark("")]
32 | //[assembly: AssemblyFileVersion("0.1.0.0")]
33 |
--------------------------------------------------------------------------------
/SSMSExecutor/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Devvcat.SSMS.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool ExecuteInnerStatements {
30 | get {
31 | return ((bool)(this["ExecuteInnerStatements"]));
32 | }
33 | set {
34 | this["ExecuteInnerStatements"] = value;
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/SSMSExecutor/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SSMSExecutor/Resources/Command1Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devvcat/ssms-executor/f3823fd73d7e524620c4e4065a5a69d57ab472d9/SSMSExecutor/Resources/Command1Package.ico
--------------------------------------------------------------------------------
/SSMSExecutor/Resources/ExecutorCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devvcat/ssms-executor/f3823fd73d7e524620c4e4065a5a69d57ab472d9/SSMSExecutor/Resources/ExecutorCommand.png
--------------------------------------------------------------------------------
/SSMSExecutor/Resources/license.txt:
--------------------------------------------------------------------------------
1 |
2 | For license, see https://github.com/devvcat/ssms-executor/LICENSE
--------------------------------------------------------------------------------
/SSMSExecutor/SSMSExecutor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(VisualStudioVersion)
7 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
8 |
9 |
10 |
11 | true
12 | Program
13 | C:\Program Files %28x86%29\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\ssms.exe
14 | $(ReferencePath);$(MSBuildThisFileDirectory)..\References\2010
15 |
16 |
17 | true
18 |
19 |
20 | v3
21 |
22 |
23 |
24 |
25 |
26 |
27 | true
28 | bin\x86\Debug\
29 | TRACE;DEBUG;SSMS
30 | full
31 | x86
32 | prompt
33 | MinimumRecommendedRules.ruleset
34 | True
35 | C:\Program Files %28x86%29\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Extensions\SqlCeToolbox
36 |
37 |
38 | bin\x86\Release\
39 | TRACE;SSMS
40 | true
41 | pdbonly
42 | x86
43 | prompt
44 | MinimumRecommendedRules.ruleset
45 |
46 |
47 |
48 | Debug
49 | AnyCPU
50 | 2.0
51 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
52 | {B8CA7C7C-2A27-46B4-899F-BF5999E3D3A1}
53 | Library
54 | Properties
55 | Devvcat.SSMS
56 | SSMSExecutor
57 | v4.5.2
58 | true
59 | true
60 | true
61 | true
62 | true
63 | false
64 |
65 |
66 | true
67 | full
68 | false
69 | bin\Debug\
70 | TRACE;DEBUG;SSMS
71 | prompt
72 | 4
73 | True
74 | C:\Program Files %28x86%29\Microsoft SQL Server Management Studio 18\Common7\IDE\Extensions\SSMSExecutor
75 | True
76 | True
77 |
78 |
79 | pdbonly
80 | true
81 | bin\Release\
82 | TRACE;SSMS
83 | prompt
84 | 4
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | Component
93 |
94 |
95 |
96 | True
97 | True
98 | Settings.settings
99 |
100 |
101 |
102 |
103 | Designer
104 |
105 |
106 |
107 | SettingsSingleFileGenerator
108 | Settings.Designer.cs
109 |
110 |
111 | Designer
112 |
113 |
114 |
115 |
116 | False
117 |
118 |
119 | False
120 |
121 |
122 | False
123 |
124 |
125 | False
126 |
127 |
128 |
129 |
130 | ..\lib\Microsoft.ReportViewer.Common.dll
131 | False
132 |
133 |
134 | ..\lib\Microsoft.ReportViewer.WinForms.dll
135 | False
136 |
137 |
138 | ..\packages\Microsoft.SqlServer.TransactSql.ScriptDom.14.0.3660.1\lib\net40\Microsoft.SqlServer.TransactSql.ScriptDom.dll
139 |
140 |
141 | False
142 |
143 |
144 |
145 |
146 |
147 | ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll
148 | True
149 |
150 |
151 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll
152 | True
153 |
154 |
155 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll
156 | True
157 |
158 |
159 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll
160 | True
161 |
162 |
163 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll
164 | True
165 |
166 |
167 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll
168 | True
169 |
170 |
171 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll
172 | True
173 |
174 |
175 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll
176 | True
177 |
178 |
179 | True
180 | ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll
181 | True
182 |
183 |
184 | True
185 | ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll
186 | True
187 |
188 |
189 | True
190 | ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll
191 | True
192 |
193 |
194 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll
195 | True
196 |
197 |
198 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll
199 | True
200 |
201 |
202 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll
203 | True
204 |
205 |
206 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll
207 | True
208 |
209 |
210 | ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll
211 | True
212 |
213 |
214 | ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll
215 | True
216 |
217 |
218 | ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll
219 | True
220 |
221 |
222 |
223 |
224 | False
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 | true
245 | Always
246 |
247 |
248 | Always
249 | true
250 |
251 |
252 | Menus.ctmenu
253 | Designer
254 |
255 |
256 |
257 |
258 | true
259 | VSPackage
260 | Designer
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
284 |
--------------------------------------------------------------------------------
/SSMSExecutor/VSPackage.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | SSMS Executor
122 |
123 |
124 | General
125 | General options page
126 |
127 |
128 | Execute Current Statement Extension
129 |
130 |
131 | Execute Current Statement for Sql Server Management Studio
132 |
133 |
134 |
135 | Resources\Command1Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
136 |
137 |
--------------------------------------------------------------------------------
/SSMSExecutor/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | False
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/SSMSExecutor/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/SSMSExecutor/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SSMS Executor
6 | SSMS Executor is a SQL Server Management Studio Add-in for executing the current statement, based on the cursor position.
7 | https://github.com/devvcat/ssms-executor
8 | Resources\license.txt
9 | https://github.com/devvcat/ssms-executor/wiki
10 | https://github.com/devvcat/ssms-executor/wiki/Release-notes
11 | Resources\Command1Package.ico
12 | ssms
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------