Date in .fmt file

Using a flat file for bcp is have a date in the format 20040922.  In the table, the field is datetime.  How do i convert to get the format file to load that column?
xoxomosAsked:
Who is Participating?
 
Scott PletcherSenior DBACommented:
The format YYYYMMDD should be fine as is.  Just be sure to make it a character value, either using a format file or, I guess, by enclosing it in quotes.
0
 
Scott PletcherSenior DBACommented:
That is, remember that dates in SQL must be character, not numeric.

For example, compare:

SELECT CAST(20040922 AS DATETIME)
SELECT CAST('20040922' AS DATETIME)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.