What are the challenges you face when working across database platforms? Take the survey

Check for Existence of Lookup Data

todtrexlertodtrexler Posts: 7
I am automating a lot of our processes using SQL Compare, SQL Data Compare, and SQL Source Control (amongst other tools,) and have found a feature that I would really like to see in SQL Compare. I don't think it IS available, and if not am wondering if there are plans for it to be a future feature.

Namely, when I am using Data Compare to script inserts to lookup tables, I would love to be able to specify that the script should check for the existence of the data, by key field, before attempting an insert.

For example, the data scripts include statements like these:
INSERT INTO [staging].[SysImportExceptionTypes] ([Id], [Description], [SysImportExceptionSeverity_Id]) VALUES (11, N'SQL code not available For Import', 3)

And I am currently modifying these by hand to look like this:
IF NOT EXISTS (SELECT * FROM [staging].[SysImportExceptionTypes] WHERE ID = 11) INSERT INTO [staging].[SysImportExceptionTypes] ([Id], [Description], [SysImportExceptionSeverity_Id]) VALUES (11, N'SQL code not available For Import', 3)

Is that something that I can get the tool to do without this manual intervention? If not, any chance of it being in a future release?


  • Options
    Unfortunately the tool does not currently have this capability.
    There is an existing feature request you may want to vote for.
    http://redgate.uservoice.com/forums/147 ... ta-compare
    These forums are actively monitored by our development team and allow our users to request features and vote on them.
    If a feature receives a significant amount of votes or is deemed to have merit development may include the feature in a future release.
    Manfred Castro
    Product Support
    Red Gate Software
Sign In or Register to comment.