Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 bcp import and bit columns

Author  Topic 

Razmo
Starting Member

5 Posts

Posted - 2009-04-15 : 15:59:23
I have this table:

CREATE TABLE SomeTable ( ID UNIQUEIDENTIFIER NOT NULL,
Name VARCHAR(50) NOT NULL,
BitCol1 BIT NULL,
BitCol2 BIT NULL,
BitCol3 BIT NULL)

into which I'm importing records using bcp.

Format File:

10.0
5
1 SQLUNIQUEID 0 16 "," 1 ID ""
2 SQLCHAR 0 50 "," 2 NAME SQL_Latin1
3 SQLBIT 0 1 "," 3 BITCOL1 ""
4 SQLBIT 0 1 "," 4 BITCOL2 ""
5 SQLBIT 0 1 "\r\n" 5 BITCOL3 ""

Data File:

NEWID(),'NAME1',1,0,1
NEWID(),'NAME2',0,0,0

After the bulk copy, a query returns these results:

UNIQUEID-1,NAME1,1,1,1
UNIQUEID-1,NAME2,1,1,1

(I've simplfied the UNIQUE ID Column for clarity)

So I have 2 questions:

1) Why is the UNIQUE ID the same in both records.
2) Why are all the bit columns 1.








visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-16 : 14:21:50
that may be because of problem with format file. are you sure row,column terminators are correct and data is also consistent?
Go to Top of Page
   

- Advertisement -