Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

Need help with CONVERT datetime

$
0
0

Hi,

I'm running SQL Server 2008 and am writing a view, but I'm not getting the intended results.  In my DB table, I have a datetime field that has the format of yyyy-mm-dd hh:mm:ss  I need to convert the field to mm-dd-yyyy.  In my view I'm using the Convert function.  Here's what I'm using: 

CONVERT (VARCHAR(10), dbo.workorders.DateReceived, 101)

My results look ok, until I try to sort the data.  If I sort in Descending order, the first record show 12/31/2013.  I have to scroll down the results to view anything in the current year.  Why is my data not sorting correctly?  Thanks!


Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>