March 20, 2004 at 4:44 pm
select id,date from temp
the above statement returns
1 2004-03-12 17:34:39.923
2 2004-02-12 17:34:39.923
i want the out put to be
1 2004-03-12
2 2004-02-12
how to do that ?
Many thanks
March 21, 2004 at 4:38 am
Use convert function
select id, convert(varchar(10), dd, 120) from temp
March 21, 2004 at 11:36 pm
Just a small typo in this, should be
select id, convert(varchar(10), date, 120) from temp
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
March 22, 2004 at 8:00 am
Since the length of the Field created for the Date will always be ten (10) characters, use CONVERT(char(10), ...) rather than CONVERT(varchar(10), ...). Less overhead, since a Field-length value need not be determined or retained.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply