Hi All.
I have a SQL 2005 database containing customer information (Table: Customer). Years ago, the front-side application used to manage this database only allowed a minimal amount of characters for the FirstName field. At that time, we used the MidName field to continue family names into our records:
If trying to write code to move any middle name starting with "&" to then end of the FirstName field, and change the MidName field to NULL, so that I have:
I figured I'd have to place FirstName and MidName into variables, but am unsure how to update a record based on the output of said record.
I had some backwards code that did in fact work, but it only did one customer per run of the code.
So, basically:
1. If MidName field starts with "&"
2. then make FirstName = Firstname + " " + MidName
3. make MidName = NULL
Any help would be greatly appreciated. THANKS!
I have a SQL 2005 database containing customer information (Table: Customer). Years ago, the front-side application used to manage this database only allowed a minimal amount of characters for the FirstName field. At that time, we used the MidName field to continue family names into our records:
Code:
FirstName MidName LastName
-------------------------------------------
John & Jody Smith
Tyrone & Knotty Shoelaces
Humphrey & Gisabell Nutt
Code:
FirstName MidName LastName
--------------------------------------------
John & Jody NULL Smith
Tyrone & Knotty NULL Shoelaces
Humphrey & Gisabell NULL Nutt
I figured I'd have to place FirstName and MidName into variables, but am unsure how to update a record based on the output of said record.
I had some backwards code that did in fact work, but it only did one customer per run of the code.
So, basically:
1. If MidName field starts with "&"
2. then make FirstName = Firstname + " " + MidName
3. make MidName = NULL
Any help would be greatly appreciated. THANKS!