I have got a table which has thousands of rows and hundreds of columns. I need to insert NULL value in all the columns except THREE for FIRST 15 rows. How do I approach with this problem statement?
I will provide with a small example below. Ex.
ID FirstNM MiddleNM LastNM Gender
1 John H Doe M
2 Katie F Hopkins F
3 Michelle A Slater M
4 John B Kiwi M
5 Alexander C Slander M
6 Arda D Putin M
7 Anuj R Trump M
8 Priyanka E Moss M
9 Hashim F George M
10 Donald G Junior M
11 Valdimir W Senior M
12 Phoenix Q Cherkov M
My output should look something like this.
ID FirstNM MiddleNM LastNM Gender
1 NULL NULL NULL NULL
2 NULL NULL NULL NULL
3 NULL NULL NULL NULL
4 NULL NULL NULL NULL
5 NULL NULL NULL NULL
6 Arda D Putin M
7 Anuj R Trump M
8 Priyanka E Moss M
9 Hashim F George M
10 Donald G Junior M
11 Valdimir W Senior M
12 Phoenix Q Cherkov M
You can simply use the below update command -
UPDATE T
SET GENDER = NULL
-- ,List all other columns assigning null value
WHERE ID <= 15;
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.