Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Date in .fmt file

Posted on 2004-09-22
2
Medium Priority
?
522 Views
Last Modified: 2008-03-06
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?
0
Comment
Question by:xoxomos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 1000 total points
ID: 12126199
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
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 12126213
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

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question