SSMS 2008 Addin - Data Scripter - Single-Quotes

Oct 5, 2009 at 4:55 PM

First off, nice tool. It's useful and easy to use.

When scripting out data (using either INSERT or "INSERT with column names"), if that data includes single-quote characters, those characters are not properly escaped.

CREATE TABLE t1 (RestaurantName varchar(20))
GO
INSERT INTO t1 VALUES ('Chart House')
INSERT INTO t1 VALUES ('Joe''s Crab Shack')
GO

Script generated by addin:

INSERT INTO t1 ([RestaurantName]) VALUES ('Chart House')
INSERT INTO t1 ([RestaurantName]) VALUES ('Joe's Crab Shack')

INSERT INTO t1 VALUES ('Chart House')
INSERT INTO t1 VALUES ('Joe's Crab Shack')

The script should look like this:

INSERT INTO t1 ([RestaurantName]) VALUES ('Chart House')
INSERT INTO t1 ([RestaurantName]) VALUES ('Joe''s Crab Shack')

INSERT INTO t1 VALUES ('Chart House')
INSERT INTO t1 VALUES ('Joe''s Crab Shack')