Sunday, February 19, 2012

Date conversion

I have a datetime field in a table and I have to insert this datatime data into antoher table. In my insert statement I convert the datetime field into varchar and then insert it into the second table.

The date field in the original table is : 2/2002/13 3:58:12 PM
but in the destination table i get: 2/2002/13 3:58:00 PM

I lose the seconds in the conversion, i think

Whats the best way to preserve to the datetime field during transfer?

thanksIt works well with:
convert(char(26),@.datetime,9)

this will preserve the format mon dd yyyy hh:mi:ss:mmmAM (or PM).

No comments:

Post a Comment