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 |
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-01-23 : 18:27:44
|
| I am using SQL 2005 and am trying to convert a date field into a number. I am subtracting Begin Date from End Date and attempting to format it as a number, but am having problems with the CONVERT function. Can anyone help me? |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2009-01-23 : 19:10:38
|
| You mean like this?declare @begindate datetimedeclare @enddate datetimeset @begindate=getdate()-30set @enddate=getdate()select datediff(d,@begindate,@enddate)Mike"oh, that monkey is going to pay" |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-01-23 : 22:46:48
|
| If U Want Like this,Just Try it OnceSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-24 : 08:48:53
|
quote: Originally posted by Nageswar9 If U Want Like this,Just Try it OnceSELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY]
why are u converting to varchar for finding diff b/w two dates? |
 |
|
|
|
|
|
|
|