April 26, 2007 at 3:30 pm
does anyone know a query that will update columns in a table that will replace all occurrences of 1/1/1900 with a logical null?
April 26, 2007 at 4:01 pm
1. You have to build a cursor or a While loop to list all columns in a given table having data type char, varchar, datetime or smalldatetime, like
select
name
from sys.columns .... -- join with sys.types here
where object_id = object_id('your_table')
2. within each loop iteration run query like this:
update your_table
set @column_name = null
where @column_name = '1/1/1900'
April 26, 2007 at 4:34 pm
Mark,
thanks for the reply. I will give it a go.
Cheers,
Phoenix
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply