How do I extract a query result of 08/27/1998 from a field of 1998-08-27 00:00:00.000 in SQL Server 2000

I am using a DTS package to export data to a CSV file.  Everything is perfect in the output file, however the vendor requesting the file needs the Date field to be in the mm/dd/yyyy format.
The field in the SQL2000 database is in the 1998-08-27 00:00:00.000 format.

I have tried the string functions, but they will not work on a datetime field.


What do I have to add to the query to extract the field in the correct format.

Thanks in advance.
colmsmith32Asked:
Who is Participating?
 
Scott PletcherSenior DBACommented:
SELECT ..., CONVERT(CHAR(10), dateField, 101), ...
0
 
rafranciscoCommented:
SELECT CONVERT(VARCHAR(10), YourDateField ,101)
FROM YourTable
0
 
colmsmith32Author Commented:
Thanks for the extremely quick response Scott !

Thanks rafrancisco also.


Does the 101 signify a specific format of output?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
rafranciscoCommented:
Yes, that's the format for mm/dd/yyyy.
0
 
Scott PletcherSenior DBACommented:
Yes.  Look in Books Online under topic "CAST and CONVERT" for the full list of possible formats; there are many more.
0
 
colmsmith32Author Commented:
Thanks again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.