diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f5014..5f60731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,5 +5,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [Unreleased] -## [0.0.1] +## [0.0.2] - 2018-12-18 +### Fixed +- fix bug in sp_executesql with an unnamed parameter value + +## [0.0.1] - 2018-11-13 - Initial release \ No newline at end of file diff --git a/README.md b/README.md index 309158e..f73140a 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Inspiring from https://github.com/mattwoberts/execsqlformat. so Thank you @mattw ## Release Notes -### 0.0.1 +## [0.0.2] - 2018-12-18 +### Fixed +- fix bug in sp_executesql with an unnamed parameter value -Initial release +## [0.0.1] - 2018-11-13 +- Initial release diff --git a/package.json b/package.json index aaa759c..159bfa2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sqlops-spexecutesql-to-sql", "displayName": "sqlops-spexecutesql-to-sql", "description": "sp_executesql to sql", - "version": "0.0.1", + "version": "0.0.2", "publisher": "pejmannikram", "icon": "images/icon.png", "repository": { diff --git a/src/extension.ts b/src/extension.ts index 478430a..d14bf97 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -26,9 +26,14 @@ export function activate(context: vscode.ExtensionContext) { const match = regex.exec(text); if (match) { + let parameters = match[2].split(","); let newText = "DECLARE " + match[2] + "\n"; - match[3].split(",").forEach((value: string) => { + match[3].split(",").forEach((value,index) => { + if (value[0]!=='@') + { + value = parameters[index].split(' ')[0] + '=' + value; + } newText += "SET " + value + "\n"; });