HI all,
This has puzzled me all morning. I have an int
field which reads 19691124 (UK dates) this is actually a
date 24 November 1969 I need to add 28 years to this
making it 19971124 but I'm stumped!
Any ideas anyone?
Cheers
SeanWhat about this
SELECT CONVERT(Char(10),DATEADD(Year,28,'19691124'),112)
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Sam" <sgpgpjr@.yahoo.ie> wrote in message
news:07b701c34248$97333560$a001280a@.phx.gbl...
> HI all,
> This has puzzled me all morning. I have an int
> field which reads 19691124 (UK dates) this is actually a
> date 24 November 1969 I need to add 28 years to this
> making it 19971124 but I'm stumped!
> Any ideas anyone?
> Cheers
> Sean
>|||DECLARE @.years INT
SET @.years =28
SELECT DATEADD(yy, @.years, CAST(int_column AS varchar(10)))
or if you want to keep it as an int:
SELECT int_column + (@.years * 10000)
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Sam" <sgpgpjr@.yahoo.ie> wrote in message
news:07b701c34248$97333560$a001280a@.phx.gbl...
> HI all,
> This has puzzled me all morning. I have an int
> field which reads 19691124 (UK dates) this is actually a
> date 24 November 1969 I need to add 28 years to this
> making it 19971124 but I'm stumped!
> Any ideas anyone?
> Cheers
> Sean
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment