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 |
mahesh423
Starting Member
9 Posts |
Posted - 2008-10-01 : 01:02:29
|
i have a query in which i need to check for today's date and need to compare it with a date column of a table which is actually integer..how to get today's date thru getdate() in a varaible in an stored proc..?after taking tat datetime filed into a variable,so now how to compare a datetime value with int field...?can anyone please let me kno asap..Mahesh Kumar |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-01 : 01:30:20
|
in MS SQL Server you can do like thisSELECT * FROM YourTable WHERE yourintegerdatecolumn=CAST(GETDATE() AS int) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-01 : 01:33:43
|
Also is your integer column having datetime value in ineger format (ie like 20081101,...) or is it having integer representing date(like 39720,..) |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-01 : 02:17:01
|
What will datetime '20081001 09:00' give integer? 39720What will datetime '20081001 19:00' give integer? 39721mahesh, it's better to useSELECT DATEDIFF(DAY, '19000101', GETDATE()) to get same integer value for whole day. E 12°55'05.63"N 56°04'39.26" |
|
|
mahesh423
Starting Member
9 Posts |
Posted - 2008-10-07 : 23:02:04
|
thanks for the reply..it helped alot..Mahesh Kumar |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-09 : 03:22:25
|
quote: Originally posted by mahesh423 thanks for the reply..it helped alot..Mahesh Kumar
But you haven't replied to questions asked MadhivananFailing to plan is Planning to fail |
|
|
|
|
|