June 7, 2011 at 9:10 am
Hi,
I have an already existing table say TABLE1 with some records, it have a column say COL1 VARCHAR(1) NOT NULL having values Y or N. I want to convert this Fixed Column to Computed Column on certain criteria say (CASE WHEN ISNULL([END_DATE], GETDATE()) >= GETDATE() THEN 'Y' ELSE 'N' END).
Please help!!!!
Sumit Rastogi
June 7, 2011 at 9:17 am
You'd need to drop the existing column then create the computed one.
Computed columns can't be created/modified through an alter column statement (the same goes for if you change the definition of a existing computed column)
June 7, 2011 at 10:08 am
Hi
you can not convert existing column with computed expression.You can add new column as Computed one in a existing table.
Thanks,
Naginder
June 7, 2011 at 11:10 pm
Thanks for the reply....
That I know thats why I already describe in the question that the table already have some records (say about .2 millions) so I think dropping is not a good idea.
Sumit
June 8, 2011 at 1:51 am
You could rename the old column to something else using sp_rename, then create the computed column. Either way you're going to want to drop the existing column at some point
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply