SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Convert the year 1900 to the year 2000
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 06/22/2006 :  09:45:27  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Minnie writes "How do you convert the year 1900 to 2000
and 1901 to 2001..etc"

khtan
In (Som, Ni, Yak)

Singapore
17642 Posts

Posted - 06/22/2006 :  09:59:38  Show Profile  Reply with Quote
if it is a datetime data type

update table
set    datecol = dateadd(year, 100, datecol)



KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22761 Posts

Posted - 06/22/2006 :  10:01:01  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Declare @d datetime
set @d='1900-01-01 10:10:10'
Select @d as [date], DateAdd(year,100,@d) as [date+100years]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000