Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters

Status
Not open for further replies.
Dec 11, 2009
60
US
I need to pass in 2 parameters @start and @end.

@start should always be - 1/1/current year
@end should always be - 12/31/current year

How can I achieve that?

Thanks,
 
Code:
declare @start datetime, @end datetime
select @start=dateadd(yy,datediff(yy,'',getdate()),'')
,@end=dateadd(dd,-1, dateadd(yy,datediff(yy,'',getdate())+1,''))
select @start, @end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top