If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > sysdate - 15

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-11, 11:23
siva_nagarajan siva_nagarajan is offline
Registered User
 
Join Date: Jul 2011
Posts: 3
sysdate - 15

hi all,

I would like to know the query to calculate date 15 days before the sysdate.
i.e. (sysdate-15)

Thanks for your help in advance.
Reply With Quote
  #2 (permalink)  
Old 07-14-11, 13:37
pradyut.dhara pradyut.dhara is offline
Registered User
 
Join Date: May 2011
Posts: 28
sysdate -15

Hi,
1> select dateadd(dd,-15,getdate())
2> go

--------------------------
Jun 29 2011 11:07PM

(1 row affected)
1>
Reply With Quote
  #3 (permalink)  
Old 07-15-11, 00:31
siva_nagarajan siva_nagarajan is offline
Registered User
 
Join Date: Jul 2011
Posts: 3
sysdate-15

Hey pradyut,

Thanks for your help. 2 more things I require..
1. The way to store the output in the variable
2. A good source to learn sybase.

Thanks again.
Reply With Quote
  #4 (permalink)  
Old 07-15-11, 02:53
pradyut.dhara pradyut.dhara is offline
Registered User
 
Join Date: May 2011
Posts: 28
Hi,
here you go.
1> declare @d1 char(8)
2>
3> select @d1= convert(char(8),dateadd(dd,-15,getdate()),112)
4> print "%1!",@d1
5> go
(1 row affected)
201106301>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On