T-SQL Stored Procedure to Merge Accounts for User in Database

Fermé Publié le il y a un an Paiement à la livraison
Fermé Paiement à la livraison

This project is for an application user that has duplicate accounts in a large enterprise application with thousands of tables.

Use the Correct Account (11111) and Duplicate Account (11112) as the Key_ID's and search the database for tables that have have a value matching the Key_ID entered.

Begin with a Start_Table table UserAccounts that is master table of account IDNUM's in the database. Use foreign keys to find the tables that reference the other tables and columns for the Key_ID. It would probably be select from system objects the Child Table by the Column Name in Parent Column and list the table names. I have a script that does that but it uses cursors and is very slow. Prefer not to use cursors. You would probably need to get the rows of the child tables and put them in a temp table, variable, or xml data. Then use those table names to query the child tables and get the records of each child table and save those and display them to allow the user to click a button to copy the records for the Duplicate Account to the Correct Account.

This is for a server admin with only SSMS and no asp.net. Set a variable ShowOrAdd to Show proposed results in SSMS or Add.

If ShowOrAdd = Show

Show the results that list by table the Correct Account rows, and Duplicate Account rows. The Database name, table names, columns and rows may vary.

The column for the Key_ID is IDNUM

Recap

The script most likely needs the start_table , Key_ID column, and Key_ID value.

Correct Account: start_table= UserAccounts , Key_ID column=IDNUM, Key_ID value=11111

Duplicate Account: start_table= UserAccounts , Key_ID column=IDNUM, Key_ID value=11112

The add records process will need to be a transaction begin, commit due to the probability of many referential integrity constraints.

Example

Correct Account IDNUM 11111

Duplicate Account IDNUM 11112

start_table = UserAccounts

UserAccounts Table

IDNUM Name (Table Columns)

11111 Micky

11112 Minnie

Display

table1

Correct Account has Rows

IDNUM,c1,c2,c3, c3,c5,c6,c7 (Table Columns)

11111, 1, 2, 3, 4, 5, a, b

11111, 1, 2, 3, 4, 1, f, b

11111, 1, 2, 4, 4, 5, a, f

Duplicate Account has Rows

IDNUM,c1,c2,c3, c3,c5,c6,c7 (Table Columns)

11112, 4, 5, 6, 7, 6, c, d

11112, 4, 5, 6, 7, 6, c, e

table2

Correct Account has Rows

IDNUM,c1,c2,c3, c3,c5 (Table Columns)

11111, 1, 2, 3, e, f

11111, 1, 1, 3, e, g

Duplicate Account has Rows

IDNUM,c1,c2,c3, c3,c5 (Table Columns)

11112, 4, 5, 6, g, f

11112, 4, 5, 3, g, j

If ShowOrAdd = Add, Add Duplicate Records to Correct IDNUM Account 11111

50 more tables possible

If you don't already have a test database with many tables and foreign keys you can install a database like Northwinds from github or create several tables with foreign keys and test the script, Sql Server 2016, Use only T-SQL if possible. Reply in advance if you need more information to complete this request.

Please reply with:

The time of day that you are available. I am available 7am to 10pm UTC-06:00 Central Time US & Canada. Will you require contact by voice and do you speak English? When you can complete the project.

Confidentiality.

a) No Use. Recipient agrees not to use the Confidential Information in any way.

b) No Disclosure. Recipient agrees to use its best efforts to prevent and protect the Confidential Information, or any part thereof.

c) Protection of Secrecy. Recipient agrees to take all steps reasonably necessary to protect the secrecy of the Confidential Information, and to prevent the Confidential Information from falling into the public domain or into the possession of unauthorized persons.

d) Scope. The scope of Confidentiality is deemed to be in all contracts present past and future with the Parties to this request

Programmation C# Serveur SQL Microsoft SQL ASP.NET T-SQL (Transact Structures Query Language)

Nº du projet : #34661957

À propos du projet

18 propositions Projet à distance Actif il y a un an

18 freelances font une offre moyenne de 47 $ pour ce travail

paskal77

Hello, I can carry out your project, I have experience in sql server c #, visual studio. I am available from 8:00 a.m. to 9:00 p.m. UTC -5:00 Bogota-Lima-Quito Please contact by chat Thanks Andres

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(110 Commentaires)
6.3
goswamiarpit475

Hello, i am available 7am to 10pm (utc -6:00). I have 10+ years of experience in full stack web development using C#, MSSQL, SSIS, ASP, VB.Net. I read the description and i am sure that i can fix the database by chang Plus

$20 USD en 7 jours
(34 Commentaires)
5.6
Muhammadsamran

Hello Sir/ Ma’am A skilled full stack developer, I have rich experience in JAVA , C , C++, C# , Python, .NET , MYSQL , SQL , Oracle, Object Oriented Programming, Data Structure, Algorithms and ARDUINO. I am very Plus

$20 USD en 7 jours
(4 Commentaires)
3.8
romansalakdev

❤️Hi Mate, I'm here to perfect all of your right away Let's come over chat so we can start discussing about the issue and I'll do it right away Regards Roman

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)
0.9
jennifersmit842

Hi There, Trust you’re keeping good! I have gone through your requirements and we can surely help you with the same. We have highly-skilled .Net development professionals bringing more than 10 years in software desi Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)
0.8
faycal388

hi, it is a hard task, i would like to help you in your project, i will use only t-sql best regards.

$20 USD en 7 jours
(0 Commentaires)
0.0
CourserXu

Hello there, I have read your requirements and am confident I am the right candidate for the job. Among other things, I have over ten years of experience in Oracle PLSQL, PostgreSQL, MySQL, MS SQL, and others. Furtherm Plus

$20 USD en 7 jours
(1 Évaluation)
0.0
cheatovfree

Hi, I have read your description carefully. I have full experience with T-SQL for 5 years. And I can carry out your task on time high quality. plz, contact me. from Cheatov R

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0
izzadfarhan

Dear Sir/Madam. We have an experienced c programming that can accommodate your company need for the project. Kindly contact us via platform. Best regards.

$20 USD en 7 jours
(0 Commentaires)
0.0
braincenter

Hello, I hope this message finds you well, Thanks for posting such an interesting project. I'm the exact type of contractor you are searching for. Having worked on similar projects for the past 10 years, I can handle Plus

$100 USD en 5 jours
(3 Commentaires)
2.6
csw2002

What you need is to do is turn on referential integrity cascade options for foreign key constraints on various child tables. When @ShowOrAdd = add, simply update the primary table and the rest of child tables will be a Plus

$68 USD en 2 jours
(0 Commentaires)
0.0