This is a discussion on Re: casting smalldatetime type within the SQL Server forums, part of the Microsoft SQL Server category; --> Use this to extract date part as string: select convert(char(10), announced, 102) from mytable Check "Books Online" and look ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Use this to extract date part as string: select convert(char(10), announced, 102) from mytable Check "Books Online" and look for CONVERT to get a list of differeft styles to convert date to string. If you need the result as SmallDateTime you can convert it again like this: select convert(SmallDateTime, convert(char(10), announced, 102)) from mytable Shervin "Richard Fox" <rfox@esops.com> wrote in message news:3f843dab$0$14004$afc38c87@... > I have a smalldatetime field 'announced' for which I want to do something > like > > select DATE(announced) FROM mytable > > I am interested in only the date part (I wish there was a 'date' type which > did not include the time) but ms sql server does not appear to have the DATE > function. I haven't been able to find the equivalent in the docs... any > suggestions? Yes, I know I can parse the value returned from the query but > this is ugly and IMHO the server should do this heavy lifting. After all, > little ol' MySQL does. > > TIA, > > RIch > > |