BCP Question

  • Is it possible to BCP OUT with different date formats? I have a BCP file coming out of a table with the dateformat 'yyyy-mm-dd hh:mm:ss' but someone is requiring it as 'dd/mm/yy hh:mm:ss'

    Any ideas appreciated!

    Andy.

  • Dont know. Why would it matter? A date is a date, formatting is normally a separate issue.

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/

  • Thats what I thought Andy.

    However someone is trying to BCP this file back into a SQL Server 6.5 but getting errors on the dates unless they change the format??

    Andy.

  • BCP out using the QUERYOUT option rather than OUT, that way you can format the date how ever you want. If you've got something against QUERYOUT, then use a view.

    BCP "SELECT convert(CHAR(8), YourDateField, 103) + ' ' + convert(CHAR(8), YourDateField, 108), --your other columns-- FROM Database.Owner.YourTable" QUERYOUT yourtable.bcp -S...the usual bits...

    Edited by - nick beagley on 08/02/2002 08:43:28 AM

    Edited by - nick beagley on 08/02/2002 08:45:41 AM

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply