Search This Blog

Thursday, March 17, 2011

Correct way of creating an extra column

select *
into newsysobjects
from sys.objects

alter table newsysobjects
add val varchar(30)
.
Another method is using SELECT...INTO with an explicit CAST like the example below

SELECT *, ISNULL(CAST('' AS varchar(30)), '') AS val
INTO dbo.newobjects
FROM sys.objects

No comments:

Post a Comment