I am new to Cursor.
How can i create a cursor for doing as below for all the tables.
I have to insert Name filed with ID in all below tables.
same id for same name, Country and email
just need to replicate with X as below.
UPDATE @CustomersTable SET [Country] = REPLICATE('X', LEN([Country])),Name =(select id from CustomersTable)
Customer table -> Now
IDNumber(pk) ID Country Name Active
1 A001 SPAIN JIM Yes
2 A002 INDIA RIM No
Person Table
Name Country IDNumber(pk)
JIM SPAIN 1
RIM INDIA 2
It has to be as below:
Customer table ->
IDNumber(pk) ID Country Name Active
1 A001 XXXXX A001 Yes
2 A002 XXXXX A002 No
Person Table ->
Name Country IDNumber(pk)
A001 XXXXX 1
A002 XXXXX 2