| Author |
Message |
tim-s
Joined: 01 Aug 2011 Posts: 1
|
Posted: Mon Aug 01, 2011 8:22 pm Post subject: Adding "IF NOT EXISTS" clauses on insert statements? |
|
|
I tried searching on this but came up blank ... basically, I'm using SQL Comparer SDK to compare the data in a master database to an older version so we can use the generated scripts to update multiple client-side databases to a newer version.
In the generated scripts, we really need each "INSERT" statement to be wrapped in an "IF NOT EXISTS" clause to avoid overwriting any conflicting client data with our default data. Is there some option I can set somewhere to force this?
Thanks! |
|
| Back to top |
|
 |
james.billings
Joined: 16 Jun 2010 Posts: 844 Location: My desk.
|
Posted: Wed Aug 03, 2011 4:01 pm Post subject: |
|
|
I don't believe there's a way to add in the command you suggest. In the UI, the results are presented as records only in the source, only in the target and "different". Is it "different" records you're wanting to exclude (i.e. where the PK of the record matches one in the source, but the actual data differs)?
If so, you might want to investigate controlling which differences are selected - I've not tried this on some useful data as yet, but something along the lines of:
foreach (TableDifference d in session.TableDifferences)
{
d.SqlSynchronization = SqlSynchronization.AddSql;
}
Should make it only generate SQL for records to be inserted, leaving those that already exist (SqlSynchronization.UpdateSql) alone. |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group