Last active
November 23, 2023 18:46
-
-
Save lundeen-bryan/cc1b85849467f0304f25a60db8191339 to your computer and use it in GitHub Desktop.
vscode_settings_nsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This keybindings file needs to go in the user folder | |
// under appdata>code>user | |
[ | |
{ | |
"key": "ctrl+k tab", | |
"command": "type", | |
"args": { "text": "\t" }, | |
"when": "editorTextFocus" | |
}, | |
{ | |
"command": "workbench.action.reopenWithEditor", | |
"key": "ctrl+k ctrl+m" | |
}, | |
{ | |
"key": "alt+t", | |
"command": "workbench.action.terminal.sendSequence", | |
"args": { | |
"text": "cd '${workspaceFolder}'" | |
} | |
}, | |
{ | |
"command": "workbench.action.closePanel", | |
"key": "ctrl+alt+x" | |
}, | |
{ | |
"when": "editorTextFocus && !editorReadonly", | |
"command": "editor.action.blockComment", | |
"key": "ctrl+shift+/" | |
}, | |
{ | |
"when": "editorTextFocus && !editorReadonly", | |
"key": "ctrl+/", | |
"command": "-editor.action.blockComment" | |
}, | |
{ | |
"key": "shift+alt+a", | |
"when": "editorTextFocus && !editorReadonly", | |
"command": "editor.action.commentLine" | |
}, | |
{ | |
"command": "regionfolder.collapseAllRegions", | |
"key": "ctrl+alt+r" | |
}, | |
{ | |
"command": "editor.action.transformToLowercase", | |
"key": "ctrl+f3 l" | |
}, | |
{ | |
"command": "editor.action.transformToTitlecase", | |
"key": "ctrl+f3 t" | |
}, | |
{ | |
"command": "editor.action.transformToUppercase", | |
"key": "ctrl+f3 u" | |
}, | |
{ | |
"command": "workbench.action.toggleMaximizedPanel", | |
"key": "ctrl+alt+m" | |
}, | |
{ | |
"command": "editor.action.toggleWordWrap", | |
"key": "ctrl+alt+w" | |
}, | |
{ | |
"key": "ctrl+alt+w", | |
"command": "-editor.action.toggleWordWrap" | |
}, | |
{ | |
"command": "toggleVim", | |
"key": "ctrl+alt+v i" | |
}, | |
{ | |
"command": "workbench.action.quickOpenSelectNext", | |
"when": "inQuickOpen", | |
"key": "ctrl+j" | |
}, | |
{ | |
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus", | |
"command": "selectNextSuggestion", | |
"key": "ctrl+j" | |
}, | |
{ | |
"command": "workbench.action.quickOpenSelectPrevious", | |
"when": "inQuickOpen", | |
"key": "ctrl+k" | |
}, | |
{ | |
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus", | |
"command": "selectPrevSuggestion", | |
"key": "ctrl+k" | |
}, | |
{ | |
"command": "workbench.action.terminal.focus", | |
"key": "ctrl+shift+`" | |
}, | |
{ | |
"key": "ctrl+w", | |
"when": "activeEditorGroupEmpty && multipleEditorGroups", | |
"command": "-workbench.action.closeGroup" | |
}, | |
{ | |
"key": "ctrl+w", | |
"command": "-workbench.action.closeActiveEditor" | |
}, | |
{ | |
"key": "ctrl+w", | |
"when": "!editorIsOpen && !multipleEditorGroups", | |
"command": "-workbench.action.closeWindow" | |
}, | |
{ | |
"command": "extension.launch", | |
"key": "ctrl+shift+b" | |
}, | |
{ | |
"key": "ctrl+shift+l", | |
"command": "-extension.launch" | |
}, | |
{ | |
"command": "extension.surroundSelection", | |
"key": "ctrl+alt+s" | |
}, | |
{ | |
"key": "shift+alt+p", | |
"command": "prettier-sql-vscode.format-selection" | |
}, | |
{ | |
"key": "shift+alt+p", | |
"command": "-projectManager.listProjects" | |
}, | |
{ | |
"command": "python.execInTerminal-icon", | |
"key": "ctrl+alt+n" | |
}, | |
{ | |
"command": "jupyter.insertCellBelow", | |
"when": "editorTextFocus && jupyter.hascodecells && !jupyter.webExtension && !notebookEditorFocused", | |
"key": "ctrl+; b" | |
}, | |
{ | |
"when": "editorTextFocus && jupyter.hascodecells && !jupyter.webExtension && !notebookEditorFocused", | |
"key": "ctrl+; b", | |
"command": "-jupyter.insertCellBelow" | |
}, | |
{ | |
"command": "jupyter.notebookeditor.addcellbelow", | |
"key": "ctrl+alt+a" | |
}, | |
{ | |
"command": "extension.vs-color-picker", | |
"key": "ctrl+alt+p" | |
}, | |
{ | |
"when": "editorTextFocus", | |
"key": "alt+[", | |
"command": "-print-it.PrintIt" | |
}, | |
{ | |
"key": "ctrl+alt+n", | |
"command": "-newFile.createNewFile" | |
}, | |
{ | |
"key": "shift+alt+y", | |
"when": "editorHasSelection", | |
"command": "-simpleTranslate" | |
}, | |
{ | |
"command": "markdown-preview-enhanced.openPreview", | |
"when": "editorLangId == 'markdown'", | |
"key": "ctrl+shift+k v" | |
}, | |
{ | |
"when": "editorLangId == 'markdown'", | |
"key": "ctrl+shift+v", | |
"command": "-markdown-preview-enhanced.openPreview" | |
}, | |
{ | |
"command": "line-to-column.splitLine", | |
"key": "ctrl+shift+alt+l" | |
}, | |
{ | |
"key": "shift+'", | |
"when": "editorHasSelection && editorTextFocus", | |
"command": "-wrapSelection.quote.double" | |
}, | |
{ | |
"command": "extension.wrap", | |
"when": "editorHasSelection", | |
"key": "ctrl+alt+t" | |
}, | |
{ | |
"when": "editorHasSelection", | |
"key": "ctrl+t", | |
"command": "-extension.wrap" | |
}, | |
{ | |
"command": "ipython.createTerminal", | |
"key": "ctrl+shift+i p" | |
}, | |
{ | |
"key": "ctrl+shift+i c", | |
"command": "-ipython.createTerminal" | |
}, | |
{ | |
"command": "math.doMath", | |
"key": "ctrl+shift+m" | |
}, | |
{ | |
"key": "ctrl+shift+m", | |
"command": "-math.doMath" | |
}, | |
{ | |
"key": "shift+alt+t", | |
"command": "QuantifiedLeap.sqlTransformer", | |
"when": "editorFocus" | |
}, | |
{ | |
"when": "textInputFocus && !accessibilityModeEnabled", | |
"key": "ctrl+shift+right", | |
"command": "-cursorWordEndRightSelect" | |
}, | |
{ | |
"when": "textInputFocus && !accessibilityModeEnabled", | |
"key": "ctrl+shift+left", | |
"command": "-cursorWordLeftSelect" | |
}, | |
{ | |
"when": "textInputFocus && !accessibilityModeEnabled", | |
"key": "ctrl+left", | |
"command": "-cursorWordLeft" | |
}, | |
{ | |
"key": "ctrl+alt+n", | |
"command": "-code-runner.run" | |
}, | |
{ | |
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'", | |
"key": "ctrl+left", | |
"command": "-extension.vim_ctrl+left" | |
}, | |
{ | |
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'", | |
"key": "ctrl+right", | |
"command": "-extension.vim_ctrl+right" | |
}, | |
{ | |
"when": "textInputFocus && !accessibilityModeEnabled", | |
"key": "ctrl+right", | |
"command": "-cursorWordEndRight" | |
}, | |
{ | |
"key": "shift+alt+n", | |
"command": "mytime.newTask" | |
}, | |
{ | |
"when": "editorTextFocus", | |
"command": "editor.action.showHover", | |
"key": "ctrl+shift+k" | |
}, | |
{ | |
"when": "textInputFocus && !editorReadonly", | |
"key": "ctrl+shift+k", | |
"command": "-editor.action.deleteLines" | |
}, | |
{ | |
"key": "ctrl+; m", | |
"command": "notebook.cell.changeToMarkdown", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputFocused && activeEditor == 'workbench.editor.notebook' && notebookCellType == 'code'" | |
}, | |
{ | |
"key": "m", | |
"command": "-notebook.cell.changeToMarkdown", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputFocused && activeEditor == 'workbench.editor.notebook' && notebookCellType == 'code'" | |
}, | |
{ | |
"key": "ctrl+; y", | |
"command": "notebook.cell.changeToCode", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputFocused && activeEditor == 'workbench.editor.notebook' && notebookCellType == 'markup'" | |
}, | |
{ | |
"key": "y", | |
"command": "-notebook.cell.changeToCode", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputFocused && activeEditor == 'workbench.editor.notebook' && notebookCellType == 'markup'" | |
}, | |
{ | |
"key": "ctrl+; l", | |
"command": "notebook.cell.toggleLineNumbers", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" | |
}, | |
{ | |
"key": "l", | |
"command": "-notebook.cell.toggleLineNumbers", | |
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" | |
}, | |
{ | |
"key": "shift+alt+e", | |
"command": "extension.exportExtensions" | |
}, | |
{ | |
"key": "ctrl+n", | |
"command": "-extension.vim_ctrl+n", | |
"when": "editorTextFocus && vim.active && vim.use<C-n> && !inDebugRepl || vim.active && vim.use<C-n> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-n> && !inDebugRepl && vim.mode == 'SearchInProgressMode'" | |
}, | |
{ | |
"key": "shift+alt+-", | |
"command": "workbench.files.action.collapseExplorerFolders" | |
}, | |
{ | |
"key": "ctrl+d", | |
"command": "-editor.action.addSelectionToNextFindMatch", | |
"when": "editorFocus" | |
}, | |
{ | |
"key": "ctrl+f3", | |
"command": "-editor.action.nextSelectionMatchFindAction", | |
"when": "editorFocus" | |
} | |
] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"update.mode": "none", | |
"vim.leader": ",", | |
"vim.startInInsertMode": false, | |
"vim.useCtrlKeys": true, | |
"vim.useSystemClipboard": true, | |
// Insert mode | |
"vim.insertModeKeyBindings": [ | |
// in insert mode jk to esc | |
{ | |
"before": ["j", "k"], | |
"after": ["<Esc>"] | |
}, | |
{ | |
"before": ["<C-l>"], | |
"after": ["<C-o>","1","l"] | |
}, | |
{ | |
"before": ["<C-l>"], | |
"after": ["<C-o>","1","l"] | |
}, | |
], | |
// Switch to insert from visual mode | |
"vim.visualModeKeyBindings": [ | |
{ | |
"before": ["i"], | |
"after": ["<Esc>", "i"] | |
} | |
], | |
"vim.normalModeKeyBindings": [ | |
{ | |
// (split windows only) switch to window right same as ctrl+up | |
"before": ["<C-l>"], | |
"commands": ["workbench.action.navigateRight"] | |
}, | |
{ | |
// (split windows only) switch to window left same as ctrl+pgdown | |
"before": ["<C-h>"], | |
"commands": ["workbench.action.navigateLeft"] | |
}, | |
{ | |
// save and exit vscode | |
"before": ["Z", "Z"], | |
"commands": [ | |
":wq" | |
], | |
}, | |
{ | |
// quit vscode w/o saving | |
"before": ["Z", "Q"], | |
"commands": [ | |
":q!" | |
], | |
}, | |
{ | |
// save with ,w | |
"before": [",", "w"], | |
"commands": [ | |
":w" | |
], | |
}, | |
{ | |
// bookmark word | |
"before": [",", "m"], | |
"commands": ["bookmarks.toggle"] | |
}, { | |
// show all bookmarks | |
"before": [",", "b"], | |
"commands": ["bookmarks.list"] | |
}, | |
{ | |
// focus on terminal | |
"before": ["<leader>", "<leader>", "t"], | |
"commands": ["workbench.action.terminal.focus"] | |
}, | |
], | |
"editor.tokenColorCustomizations": { | |
"enabled": true, | |
"rules": { | |
"semanticHighlighting": true | |
}, | |
"comments": "#87ff7c" | |
}, | |
"vim.textwidth": 120, | |
"editor.tabCompletion": "onlySnippets", | |
"editor.quickSuggestions": { | |
"other": true, | |
"comments": false, | |
"strings": false | |
}, | |
"window.zoomLevel": 1, | |
"editor.minimap.enabled": true, //no map=false | |
"editor.stablePeek": true, | |
"editor.fontFamily": "'Anonymous Pro','Fira Code', Consolas, 'Courier New', monospace", | |
"editor.fontLigatures": true, | |
"editor.fontSize": 12, | |
"editor.cursorBlinking": "solid", | |
"editor.unusualLineTerminators": "prompt", | |
"editor.defaultFormatter": "vscode.html-language-features", | |
"editor.formatOnPaste": true, | |
"editor.formatOnSave": true, | |
"editor.wordWrapColumn": 150, | |
"editor.wordWrap":"on", | |
"editor.lineNumbers": "relative", | |
"editor.linkedediting": false, | |
"[css]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
"[html]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
"[javascript]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
"files.trimTrailingWhitespace": true, | |
"workbench.iconTheme": "vscode-icons", | |
"html-css-class-completion.enableEmmetSupport": false, | |
"html-css-class-completion.includeGlobPattern": "**/*.{css,html}", | |
"emmet.showSuggestionsAsSnippets": false, | |
"html.format.wrapLineLength": 0, | |
"prettier.singleQuote": true, | |
"prettier.proseWrap": "never", | |
"highlight-matching-tag.styles": { | |
"opening": { | |
"left": { | |
"custom": { | |
"borderWidth": "0 0 0 3px", | |
"borderStyle": "solid", | |
"borderColor": "yellow", | |
"borderRadius": "5px", | |
"overviewRulerColor": "white" | |
} | |
}, | |
"right": { | |
"custom": { | |
"borderWidth": "0 3px 0 0", | |
"borderStyle": "solid", | |
"borderColor": "yellow", | |
"borderRadius": "5px", | |
"overviewRulerColor": "white" | |
} | |
} | |
} | |
}, | |
"better-comments.highlightPlainText": true, | |
"better-comments.multilineComments": true, | |
"editor.tabSize": 2, | |
"files.eol": "\r\n", | |
"sync.gist": "", | |
"sync.autoDownload": false, | |
"newFile.defaultBaseFileName": "newFile", // "root" or "project" or "file" | |
"newFile.defaultFileExtension": ".html", | |
"newFile.rootDirectory": "~", // "project" or "none" or "root" | |
"newFile.expandBraces": false, | |
"newFile.fileTemplates": { | |
}, | |
"newFile.showPathRelativeTo": "project", | |
"newFile.relativeTo": "project", | |
"projectManager.git.baseFolders": [ | |
"C:\\Users\\bigbry\\Projects\\source\\repos\\" | |
], | |
"tabnine.experimentalAutoImports": true, | |
"vim.easymotion": true, | |
"vim.smartRelativeLine": true, | |
"workbench.editorAssociations": { | |
"*.ipynb": "jupyter.notebook.ipynb" | |
}, | |
"workbench.colorTheme": "Chameleon", | |
"vsicons.dontShowNewVersionMessage": true, | |
"bracketPairColorizer.depreciation-notice": false, | |
"terminal.integrated.defaultProfile.windows": "Git Bash", | |
"[vba]": { | |
}, | |
"mssql.connections": [ | |
{ | |
"server": "mhnodssql1p", | |
"database": "", | |
"authenticationType": "Integrated", | |
"password": "" | |
}, | |
{ | |
"server": "nshsql2p", | |
"database": "", | |
"authenticationType": "Integrated", | |
"password": "" | |
}, | |
{ | |
"server": "mhnodssql1p", | |
"database": "ODS", | |
"authenticationType": "Integrated", | |
"profileName": "ODS_1", | |
"password": "" | |
}, | |
{ | |
"server": "nshsql2p", | |
"database": "CourtReport", | |
"authenticationType": "Integrated", | |
"profileName": "CourtReport_1", | |
"password": "" | |
}, | |
{ | |
"server": "nshsql1p", | |
"database": "", | |
"authenticationType": "Integrated", | |
"password": "", | |
"trustServerCertificate": true | |
} | |
], | |
"vim.vimrc.path": "$HOME/.vim/_vimrc", | |
"vim.vimrc.enable": true, | |
"rewrap.autoWrap.enabled": true, | |
"rewrap.wrappingColumn": 72, | |
"mssql.intelliSense.enableIntelliSense": false | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Tips":{ | |
"prefix": "b'sqltips", | |
"body": [ | |
"--Sweaty(SELECT) Feet(FROM) Will(WHERE) Give(GROUP BY) Horrible(HAVING) Oder(ORDER BY)", | |
"--SELECT", | |
"--FROM", | |
"--WHERE", | |
"--GROUP BY", | |
"--HAVING", | |
"--ORDER BY", | |
"--", | |
"----Limitations of CTEs", | |
"--1. CTEs can only be used in the current query scope, meaning they cannot be referenced after the final SELECT", | |
"--2. This can be a problem if you need to reuse your virtual tables multi times for diff purposes", | |
"--3. cannot be referenced individually, making degugging more difficult", | |
"--4. certain optimization techniques are not available to CTEs", | |
"--SQL Join Types PDF" | |
], | |
"description": "Puts tips in comments" | |
}, | |
"Find datatype in column":{ | |
"prefix": "b'find_datatype", | |
"body": [ | |
"SELECT table_schema, table_name, collumn_name, data_type, collation_name", | |
"FROM INFORMATION_SCHEMA.COLUMNS", | |
"WHERE 1=WHERE 1=1", | |
"AND TABLE_SCHEMA = [${1:schema-name}] AND TABLE_NAME = [${2:table-name}];", | |
"--If the collation_name has CI in it then it is case insensitive" | |
], | |
"description": "inserts method to find data type of column" | |
}, | |
"Find Column By Name":{ | |
"prefix": "b'find_column", | |
"body": [ | |
"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE 1=1 AND COLUMN_NAME LIKE '%${1:column_name}%' ORDER BY TABLE_NAME", | |
], | |
"description": "asks for column name and will find it in any db table" | |
}, | |
"Find Table by Name":{ | |
"prefix": "b'find_table", | |
"body": [ | |
"SELECT [Table Names] = [name] FROM SYS.TABLES" | |
], | |
"description": "asks for table name to search for word in table name." | |
}, | |
"Setup SQL Query": { | |
"prefix": "b'Setup_sql", | |
"body": [ | |
"--/*", | |
"SELECT", | |
" [${6:alias}] = $5.[${7:column}]", | |
"FROM", | |
" [${3:schema}].[${4:table}] AS ${5:table_alias}", | |
"WHERE 1=1", | |
";", | |
"--*/", | |
"\n\n", | |
"$BLOCK_COMMENT_START", | |
"\tFilename: ...: $TM_FILENAME", | |
"\tDate ........: $CURRENT_DATE-$CURRENT_MONTH_NAME_SHORT-$CURRENT_YEAR", | |
"\tTime ........: $CURRENT_HOUR:$CURRENT_MINUTE", | |
"\tDesc ........: ${1:description}", | |
"\tNotes........:", | |
"\t\t1. ", | |
"$BLOCK_COMMENT_END", | |
"\n\n", | |
"GO" | |
], | |
"description": "Creates a SQL query with a comment block" | |
}, | |
"Add new Select statement":{ | |
"prefix": "b'select", | |
"body": [ | |
"--/* ${6:ref-number} ", | |
"SELECT", | |
" [${4:alias}] = $3.[${5:column}]", | |
"FROM", | |
" [${1:schema}].[${2:table}] AS ${3:table_alias}", | |
"WHERE 1=1", | |
";", | |
"--*/", | |
"\n" | |
], | |
"description": "Adds Select Statement without comments or source" | |
}, | |
"Select Count One-Line":{ | |
"prefix": "b'count", | |
"body": [ | |
"SELECT [$2] = COUNT(*) FROM [${1:schema}].[${2:table}]", | |
], | |
"description": "Insert a one-line SELECT" | |
}, | |
"Add Join":{ | |
"prefix": "b'join", | |
"body": [ | |
"${1|INNER ,LEFT OUTER ,FULL OUTER ,RIGHT OUTER |} JOIN", | |
" [${2:schema}].[${3:table}] AS ${4:table_alias}", | |
"ON", | |
" ${5:alias1}.[${6:table1}] = $4.[$6]" | |
], | |
"description": "Inserts a new join" | |
}, | |
"Create a correlated subquery":{ | |
"prefix": "b'correlated-sub", | |
"body": [ | |
", [${1:derived-column}] = ", | |
"(", | |
"SELECT ${7:COUNT(*)}", | |
"FROM [${2:schema}].[${3:table}] AS ${4:alias}", | |
"WHERE $4.[${5:column}] = ${6:alias}.[$5]", | |
")" | |
], | |
"description": "Inserts a correlated subquery" | |
}, | |
"Cut current query and insert as subquery":{ | |
"prefix": "b'subquery", | |
"body": [ | |
"SELECT", | |
" *", | |
"FROM (", | |
"$CLIPBOARD", | |
") AS ${1:alias}", | |
"WHERE [${2:filter}] = ${3:value}", | |
"\n" | |
] | |
}, | |
"Pivot":{ | |
"prefix": "b'pivot_single", | |
"body": [ | |
"\n", | |
"--/*", | |
"SELECT [${9}]", | |
"\t,[${10}]", | |
"\tFROM (SELECT [${4:source tbl column 1}]", | |
"\t\t\t, [${5:source tbl column 2}]", | |
"\t\tFROM [${1:source schema}].[${2:source tbl}]) AS ${3:alias}", | |
"\t\tPIVOT(${6|SUM,AVG,MAX,MIN|}([${7:aggregate column}])", | |
"\t\tFOR [${8:column contains headers}]", | |
"\t\tIN([${9:pivot column 1}], [${10:pivot column 2}])) AS ${11:alias}", | |
"ORDER BY 1", | |
"--*/", | |
"\n" | |
] | |
}, | |
"Case Statement": { | |
"prefix": "b'case_setup", | |
"body": [ | |
"[${1:first_case}] =", | |
"CASE", | |
"\tWHEN ${2:first_when}", | |
"\t\tTHEN ${3:then_this}", | |
"\tELSE ${4:else_this}", | |
"END" | |
], | |
"description": "Inserts Case-When-Else Statement" | |
}, | |
"When Statement": { | |
"prefix": "b_when", | |
"body": [ | |
"WHEN ${1:when_statement}", | |
"\tTHEN ${2:then_statement}" | |
], | |
"description": "Inserts when-then statement" | |
}, | |
"Insert CTE":{ | |
"prefix": "b'cte_sql", | |
"body": [ | |
"--/*", | |
"WITH Step1 AS", | |
"(", | |
"/* This contains inner query & derived columns */", | |
"SELECT [column]", | |
"FROM [${1:schema}].[${2:table}]", | |
")", | |
",", | |
"Step2 AS", | |
"(", | |
"/* This contains outer querry from inner */", | |
"SELECT [column]", | |
"FROM Step1", | |
")", | |
"SELECT", | |
"[column-alias]", | |
",[column-alias]", | |
"FROM Step2 AS A", | |
"JOIN Step2 AS B", | |
"ON A.matching_column = B.matching_column", | |
"ORDER BY 1", | |
"--*/" | |
], | |
"description": "Inserts a Common Table Expression" | |
}, | |
"Insert Date Series":{ | |
"prefix": "b'date_series", | |
"body": [ | |
"WITH", | |
"[DateSeries] AS (SELECT CAST('${1:starting date mm-dd-yyyy}' AS DATE) AS [${3:column_name}]", | |
"UNION ALL", | |
"SELECT DATEADD(DAY, 1, [$3])", | |
"FROM [DateSeries]", | |
"WHERE 1=1", | |
"AND [$3] < CAST('${2:end date mm-dd-yyyy}' AS DATE))", | |
"SELECT [$3]", | |
"FROM [DateSeries]", | |
"OPTION(MAXRECURSION 365)" | |
], | |
"description": "Inserts dates in a series" | |
}, | |
"Insert Number Series":{ | |
"prefix": "b'number_series", | |
"body": [ | |
"WITH", | |
"[NumberSeries] AS (SELECT 1 AS [MyNumber]", | |
"UNION ALL", | |
"SELECT [MyNumber] + 1", | |
"FROM [NumberSeries]", | |
"WHERE 1=1", | |
"AND [MyNumber] < ${1:max_number})", | |
"SELECT [MyNumber]", | |
"FROM [NumberSeries]", | |
"OPTION(MAXRECURSION $1)" | |
], | |
"description": "Inserts numbers in a series" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment