Welcome Guest, Login
Image
RSS RSS

Navigation


Quick Search
»



Page History: Cannot insert duplicate key row in object 'dbo.cw_client' with unique index 'UNQ_eurn'

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Thu, 18 Sep 2014 09:23


Source: jProgBusiness - Cannot insert duplicate key row in object 'dbo.cw_client' with unique index 'UNQ_eurn'. The duplicate key value is (Z0BB3wQqJ). The statement has been terminated. INSERT INTO cw_client ( cln_encrypted_data , cln_pk , cln_estimated_birthdate , cln_encrypted_uci , cln_eurn , cln_vtl_st_rfk , cln_race_white , cln_race_black , cln_race_asian , cln_race_pacific , cln_race_indian , cln_race_other , cln_race_unknown , cln_hiv_risk_1_homo_male , cln_hiv_risk_2_injection_user , cln_hiv_risk_3_hetero_contact , cln_hiv_risk_4_hemophilia_transfusion , cln_hiv_risk_5_perinatal_transmission , cln_hiv_risk_6_other , cln_hiv_risk_7_transfusion , cln_hiv_risk_9_undetermined_unknown , cln_hispanic_yes_un_rfk , cln_hiv_subtype_i , cln_hiv_subtype_ii , cln_aids_date_estimated , cln_hiv_date_estimated , cln_hiv_st_rfk , cln_urn , cln_last_name , cln_first_name , cln_last_name_soundex , cln_first_name_soundex , cln_middle_name , cln_dob , cln_gnd_rfk , cln_last_updated) VALUES (@cln_encrypted_data , @cln_pk , @cln_estimated_birthdate , @cln_encrypted_uci , @cln_eurn , @cln_vtl_st_rfk , @cln_race_white , @cln_race_black , @cln_race_asian , @cln_race_pacific , @cln_race_indian , @cln_race_other , @cln_race_unknown , @cln_hiv_risk_1_homo_male , @cln_hiv_risk_2_injection_user , @cln_hiv_risk_3_hetero_contact , @cln_hiv_risk_4_hemophilia_transfusion , @cln_hiv_risk_5_perinatal_transmission , @cln_hiv_risk_6_other , @cln_hiv_risk_7_transfusion , @cln_hiv_risk_9_undetermined_unknown , @cln_hispanic_yes_un_rfk , @cln_hiv_subtype_i , @cln_hiv_subtype_ii , @cln_aids_date_estimated , @cln_hiv_date_estimated , @cln_hiv_st_rfk , @cln_urn , @cln_last_name , @cln_first_name , @cln_last_name_soundex , @cln_first_name_soundex , @cln_middle_name , @cln_dob , @cln_gnd_rfk , @cln_last_updated)

at jProgBusiness.jBusiness.jBusinessClient.ClientAdd(String GUIDToken, jClientAdd NewClientAdd, Boolean skipClientPresearch, String domainToImportTo) at jProgBusiness.jBusiness.jBusinessRemote.CLN_Client_Add(String SessionToken, jClientAdd NewClientAdd, Boolean skipClientPresearch, String domainToImportToPK) An error occured while adding a new client to the central database. You will not be able to add a client to the central database at this time. If the problem persists, please contact technical support.

This error can occur when there is already a client in the system with a matching URN. If it is a duplicate client record in your database, you can try to find the record by using the Find Client screen. If the client is found and already exists in your records, use that client instead of creating a new client record. If you are unable to find the client record through the CAREWare interface, then it is probably an orphaned client record that will have to be found by running a query on the SQL CAREWare database. This can happen if a client is not completely deleted for some reason.

The following queries run on the SQL Server CAREWare instance will find and remove orphaned client records -- ones that are in the data base but not associated with a provider domain, so they can't be found.

Create a CAREWare Backup first

Login to the Central Adminstration domain Go to Administrative Options>Backup>View Data Backup Options>Create Backup Now Press F1 - Select All Press F3 - Initiate Backup Close back to the Main Menu Check the Administrative Alarms to verify the backup has been created successfully after about 20 to 30 minutes

Then connect to the CAREWare SQL database using SQL Management Studio and run the Select query on the SQL Server to find the dangling clients Login to the CAREWare SQL Server itself and run this SQL query

SELECT * FROM cw_client WHERE (NOT EXISTS (SELECT * FROM cw_map_client_provider WHERE (map_cl_cln_fk = cw_client.cln_pk)))

Run the Delete query on the SQL Server to delete any dangling clients DELETE FROM cw_client WHERE (NOT EXISTS (SELECT * FROM cw_map_client_provider WHERE (map_cl_cln_fk = cw_client.cln_pk)))

Then rerun the Select query to see if any other dangling clients still exist. If there are no remaining dangling clients found then you can go back into CAREWare and try to add the client again.

jProg is a registered trademark of Jeff Murray's Programming Shop, Inc. All other products mentioned are registered trademarks or trademarks of their respective companies. Questions or problems regarding this web site should be directed to JeffMurray@jprog.com.

© 1998- Jeff Murray's Programming Shop, Inc. (jProg) , all rights reserved.