Wednesday, March 7, 2012

Convert Smalldatetime

Hello everyone. I am running into some small problems converting a smalldatetime field. I currently have 2005-10-17 00:00:00
in the field but what it to have forward slashes instead of th dash. I tried a few convert methods but not successful.

Does anyone have any ideas on how to make this work?

All help is appreciated.Hello everyone. I am running into some small problems converting a smalldatetime field. I currently have 2005-10-17 00:00:00
in the field but what it to have forward slashes instead of th dash. I tried a few convert methods but not successful.

Does anyone have any ideas on how to make this work?

All help is appreciated.

Try convert(varchar(10), getdate(), 111)

Regards,

hmscott|||Try convert(varchar(10), getdate(), 111)

Regards,

hmscott

Thanks Again. I worked just fine.|||WHY...do you want to conver the datetime value in the first place? Or are you just trying to truncate off the time portion, in which case this method is faster if less intuitive:
select dateadd(day, datediff(day, 0, getdate()), 0)

No comments:

Post a Comment