The [] are a syntactical notation for optional parameters; they are not
meant to be actually typed in the command. Moreover, you can not
"shorten" a DATETIME value--it is always 8 bytes. What you want is:
CONVERT(VARCHAR(10), '2004-07-28 12:53:29.957', 110)
What I don't understand is why you are CONVERT'ing a literal value? If
you only supply the date part of a DATETIME value into such a column or
variable, it will just zero-out--indicate midnight--the time portion.
Sincerely,
Anthony Thomas, MCDBA, MCSA
-----Original Message-----
From: Biswaranjan Rath
[mailto:mssqldba-ezmlmshield-x80381579.[Email address protected]
Sent: Thursday, July 29, 2004 12:25 AM
To: LazyDBA Discussion
Subject: Date formatting using convert
Syntax of Conevrt is
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
I'm trying as
select convert(datetime [ 8 ], '2004-07-28 12:53:29.957', 110)
but it's not working. even i tried
select convert(datetime [ 'mm-dd-yyyy' ], '2004-07-28 12:53:29.957',
110)
i want the date in mm-dd-yyyy format. so can anyone suggest me...
With best regards
Biswaranjan Rath
Subject Matter Expert
Amdocs DVCI, Pune, India
Phone : +91-20-4048951 Extn.: 302(Office)
+91-20-4062302 (Direct)
------------------------------------------------------------------------
-------------
The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated
recipient(s)
of the message. If the reader of this message is not the intended
recipient,
you are hereby notified that any dissemination, use, distribution or
copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us
immediately
by replying to the message and deleting it from your computer.
Thank you.
---------------------------------------------------------
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]
***********************************************************************
NOTICE: This electronic mail message and any attached files are
confidential. The information is exclusively for the use of the
individual or entity intended as the recipient. If you are not the
intended recipient, any use, copying, printing, reviewing, retention,
disclosure, distribution or forwarding of the message or any attached
file is not authorized and is strictly prohibited. If you have received
this electronic mail message in error, please advise the sender by reply
electronic mail immediately and permanently delete the original
transmission, any attachments and any copies of this message from your
computer system.
***********************************************************************
MS Sql Server LazyDBA home page