I need to add a non-static column to a table in SQL Server -
i trying add column , populate in sql server 2008 using:
alter table tbl_1 add 'actuals_' & year(getdate())-3 update tbl_1 set 'actuals_' & year(getdate())-3 = tbl_2.txtytd tbl_2 tbl_2.year = year(getdate())-3
my reason need have column change when year changes data within change based on current year. table dropped , recreated each time. have tried using + instead of &.
any , resources appreciated.
Comments
Post a Comment