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
 General SQL Server Forums
 New to SQL Server Programming
 Yearly

Author  Topic 

BankOfficerHere
Posting Yak Master

124 Posts

Posted - 2009-02-18 : 05:02:33
Hi,

I have this sql that states:

DATEADD(quarter, DATEDIFF(quarter, '19001101', GETDATE()), '19000101')

I want it in yearly. Meaning, every year (Jan1) it moves.

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-02-18 : 05:10:53
Not sure if you need this

DATEADD(quarter, DATEDIFF(quarter, '19001101', GETDATE())-1, '19000101')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-02-18 : 05:13:11
Not sure ,let me guess, tthis ?

select DATEADD(year, DATEDIFF(year, '19001101', GETDATE()), '19000101')
Go to Top of Page

ke.neelima
Starting Member

6 Posts

Posted - 2009-02-18 : 06:34:26

Not clear with ur question..
Dunno..if u r looking for this..?

DATEADD(quarter, DATEDIFF(quarter, '19001101', GETDATE())+4, '19000101')


Neelima
Go to Top of Page

BankOfficerHere
Posting Yak Master

124 Posts

Posted - 2009-02-18 : 06:37:33
yes i want it to move every year..once a year
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-02-18 : 07:27:16
quote:
Originally posted by BankOfficerHere

yes i want it to move every year..once a year


Not clear. Give us some sample data with expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-02-18 : 07:32:25
How do you mean you want to move it a year on every year, are you meaning that you updating for example a subcription and want to add a year onto the existing date if so then the above post would work other wise supply something that you are expecting to happen for us to look at
Go to Top of Page
   

- Advertisement -