Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Date in .fmt file

Posted on 2004-09-22
2
Medium Priority
?
532 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
  • 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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
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.

971 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