PejmanNik/sqlops-spexecutesql-to-sql

Double quote incorrectly resolved

CalinM opened this issue · 1 comments

In case there are double-quoted strings inside the executed code, the extension fail to resolve them:

EXEC sp_executesql N'
DECLARE
@sampleValues TABLE (
Id INT,
StrValue NVARCHAR(5)
)

INSERT INTO @sampleValues
SELECT 0, ''aa''
UNION
SELECT 1, ''bb''
UNION
SELECT 2, ''cc''
UNION
SELECT 3, ''dd''

SELECT * FROM @sampleValues
SELECT @dummyParam
', N'@dummyParam INT', @dummyParam=123;

outputs:

DECLARE @dummyParam INT
SET @dummyParam=123;

DECLARE
@sampleValues TABLE (
Id INT,
StrValue NVARCHAR(5)
)

INSERT INTO @sampleValues
SELECT 0, ''aa
''
UNION
SELECT 1, ''bb
''
UNION
SELECT 2, ''cc
''
UNION
SELECT 3, ''dd
''

SELECT *
FROM @sampleValues
select @dummyParam

Hello @CalinM. Thank you for using this extension. you can now update to 1.0.2