Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
hello friends,i was stuck in one logic of date in Storeprocedure.I have two date type of field, suppose in first field 12/25/2008 is there,so i want a logic in which it will return minus one day in second field.First field:- 12/25/2008Output should be:- 12/24/2008Please help me,Thanks,Abhi
dinakar
Master Smack Fu Yak Hacker
2507 Posts
Posted - 2008-11-14 : 23:49:31
Look at Datediff function in books online.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-11-14 : 23:50:18
just use
DATEADD(dd,DATEDIFF(dd,0,FirstField),-1)
for second field
karthickbabu
Posting Yak Master
151 Posts
Posted - 2008-11-14 : 23:51:59
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114073==================================================== you realize you've made a mistake, take immediate steps to correct it.