Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 NEED FUNCTION

Author  Topic 

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-09-26 : 07:41:20
ANY FUNCTION ???

DATE = MM/DD/YYYY

IF I GIVE 03/21/2006 IT SHUD GIVE 01/01/2006

IT SHUD GIVE ,GIVEN YEAR WITH JANUARY 1ST ..

ANOTHER EX: INPUT = 04/28/1999 OUTPUT = 01/01/1999


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-26 : 07:53:41
SELECT DATEADD(YEAR, DATEDIFF(YEAR, '20000101', @YourDateHere), '20000101')



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-09-26 : 07:55:30
Use select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)

replace getdate() with your date parameter.
Go to Top of Page
   

- Advertisement -