I need to add days to a date field, my date field is as varchar(20041030 for example) and I need to add 4 days to it, my result should be 20041103, result field is also in varchar,how would I do that, can anyone pls help?
thx in advance!!
Printable View
I need to add days to a date field, my date field is as varchar(20041030 for example) and I need to add 4 days to it, my result should be 20041103, result field is also in varchar,how would I do that, can anyone pls help?
thx in advance!!
create table test1 (date varchar(8))
insert into test1 select '20041030'
insert into test1 select '20040829'
insert into test1 select '20040909'
select date ,convert(varchar(8),dateadd(dd,4,date),112) as mydate from test1
Thanks Mak!! Works.