[dba-SQLServer] Update query leaves null

JWColby jwcolby at colbyconsulting.com
Fri Aug 11 15:38:28 CDT 2006


I need to build a new field on a table, and insert the first N characters of
Y other fields into that new field.  This will be known as a match code and
it is an accepted and known method in the client's industry of weeding out
duplicates.  For example I need to create a new string with the first 5
characters of the first name, last name, address1, address2, zip and the
plus4.  I will write this new string back into a new field.  What I want to
do is to build a unique index on the field.  Then as the update occurs, I
need a silent failure if the match code already exists.  Thus if the same
exact match code is already in the table, just leave a null of empty string
in that match field for the duplicate record.  Doing this would allow me to
then go back and delete the records where the match code is null and
"de-dupe" the table.

If I do an update query in SQL, will it do this silent failure or will it
stop and announce the failure?  Do I need to do something specific to get a
"silent failure"?

John W. Colby
Colby Consulting
www.ColbyConsulting.com





More information about the dba-SQLServer mailing list