Chop zeros off end of date

Chop zeros off end of date

Post by scorpion5306 » Sat, 26 Apr 2003 00:48:30



I have a varchar field which has date information (came from access, DTS
didnt get along with the file for some reason) and it has trailing zeros.
How can I tell it to remove these zeros in the display? Th date is formated
as 7/26/2001 0:00:00

select field1, date(Cast as ?), field2 from tblname order by field1

 
 
 

Chop zeros off end of date

Post by Aaron Bertrand - MV » Sat, 26 Apr 2003 00:58:44


SELECT CONVERT(CHAR(10), datecolumn, 101) FROM tblname


Quote:> I have a varchar field which has date information (came from access, DTS
> didnt get along with the file for some reason) and it has trailing zeros.
> How can I tell it to remove these zeros in the display? Th date is
formated
> as 7/26/2001 0:00:00

> select field1, date(Cast as ?), field2 from tblname order by field1


 
 
 

Chop zeros off end of date

Post by oj » Sat, 26 Apr 2003 01:08:48


You want to use convert(varchar,<your_date_col>,<dateformat>). See book
online for a list of dateformats.

--
-oj
RAC v2.1 & QALite!
http://www.rac4sql.net


Quote:> I have a varchar field which has date information (came from access, DTS
> didnt get along with the file for some reason) and it has trailing zeros.
> How can I tell it to remove these zeros in the display? Th date is
formated
> as 7/26/2001 0:00:00

> select field1, date(Cast as ?), field2 from tblname order by field1

 
 
 

1. database link - SQL getting chopped off?

We have some SQL here that uses a database link.  It works fine in most of
our
environments, but when we try and execute it in our production environment,
we get an error.

insert into table1

where  b.field3 = 'X'
 and b.field4 = 'Y'

(The real SQL is much longer.)  It usually errors out with an  ORA-03113:
end-of-file on communication channel.  When we start reducing the where
clauses, (down to a total of about 2120 bytes for the whole SQL statement)
it will work.

One test actually worked with the full SQL but the results were as if the
last line of the where clause was never part of the
SQL statement.  It returned many more rows than the full where clause would
have allowed.

Is there a parameter to set the number of bytes a database link can
handle???

Any other ideas out there?

Thanks for any info on this!       -Dan

2. Blobs in Ingres 6.5

3. Field object chops off data

4. heap_blks_hit and heap_blks_read

5. ((Current Date - Start Date)/(End Date - Start Date))*Contract Amt

6. View Security

7. How to turn off DIV BY ZERO errors

8. dbpoll() problem

9. Jet Engine stripping off leading zero

10. COleVariant class object strips off any leading/trailing zeros

11. How do I get the start date and end date of week #35

12. Between 2 dates not returning data for the end date