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.
| Author |
Topic |
|
d3ng
Yak Posting Veteran
83 Posts |
Posted - 2009-03-04 : 23:58:31
|
| Hi SQL Experts,I would like to know for a script on how to get the expiration date if I only specify 3 months from my referrence date like for ex.referrence date: 11/01/2009Expiratiin date: 02/01/2010 |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2009-03-05 : 00:01:08
|
| declare @Expiratiinset Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-03-05 : 00:02:20
|
quote: Originally posted by jhocutt declare @Expiratiinset Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
SMALL MODIFICATION IN UR QUERYdeclare @Expiratiin DATETIMESELECT Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin(OR)declare @Expiratiin VARCHAR(32)SELECT Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-05 : 01:57:16
|
quote: Originally posted by Nageswar9
quote: Originally posted by jhocutt declare @Expiratiinset Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
SMALL MODIFICATION IN UR QUERYdeclare @Expiratiin DATETIMESELECT Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin(OR)declare @Expiratiin VARCHAR(32)SELECT Expiratiin = DateAdd(m, 3, '11/01/2009')print @Expiratiin
Always use proper DATETIME datatype to store datesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|