Groups | Blog | Home
all groups > sql server (microsoft) > january 2007 >

sql server (microsoft) : URGENT:SQL SERVER conveting date to integer


Usha
1/25/2007 1:23:45 PM
Hi

I have a date column.I want to convert this date to integer.Similarily
I want to convert current date to integer and find the difference
between these two dates

Please let me know regarding the same.
Regards
Usha
Steve
1/25/2007 9:01:11 PM

[quoted text, click to view]

I'm not sure of your question...
SELECT CONVERT(int,GETDATE())
sriram
1/29/2007 8:31:53 PM
[quoted text, click to view]

Hope this will also help you,

SELECT CONVERT(int, CONVERT(char(12),GETDATE(),12))
sriram
1/29/2007 8:36:13 PM
[quoted text, click to view]

I thiknk you could better use the datediff function...that will surve
your purpose without any conversions. The syntax for the same would be

DATEDIFF ( datepart , startdate , enddate )
AddThis Social Bookmark Button