Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 replace values with NULL value for whole column

Author  Topic 

jpotucek
Constraint Violating Yak Guru

273 Posts

Posted - 2011-10-27 : 12:25:00
I have a table in my sql server 2005 database where I need to replace all the values in one particular column with null values.

the column excepts NULL values and is currently populated with email addresses. I need to programatically replace all of the email addresses with a NULL Value.

Short of exporting the table, removing the email addresses and reimporting the data into the table, how can I do this with T-SQL?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-27 : 12:28:53
[code]
UPDATE table
SET Email=NULL
[/code]
sets all emails to NULL in the table
where do you want to export table data to?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jpotucek
Constraint Violating Yak Guru

273 Posts

Posted - 2011-10-27 : 15:49:09
Thank you.

They just wanted the emails nulled out in that column one when I refresh from PROD to DEV and the update statement worked like a charm.

seems like such a simple thing now !!

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-10-27 : 15:53:50
Ya think?

What are they doing about Names, Street address, Phones and SSN, Salaries, Hire Date, Birth Date, Employee Level, Bonuses, etc.?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-28 : 06:44:20
quote:
Originally posted by jpotucek

Thank you.

They just wanted the emails nulled out in that column one when I refresh from PROD to DEV and the update statement worked like a charm.

seems like such a simple thing now !!




what we do is not to make them null but run a scrambling algorithm in update to scramble the data before we give it to our developers for playing with

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -