468,104 Members | 1,467 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,104 developers. It's quick & easy.

Bulk inserting into table with computed columns

Using SS2K, I'm getting the following error while bulk inserting:

Column 'warranty_expiration_date' cannot be modified because it is a
computed column.

Here is my bulk insert statement:

BULK INSERT dbo.TestData
FROM 'TestData.dat'
WITH (CHECK_CONSTRAINTS,
FIELDTERMINATOR='|',
MAXERRORS = 1,
FORMATFILE='TestData.fmt')

The computed column is not referenced in the format file and the data file
does not contain the computed data.

Thanks
Jul 20 '05 #1
2 10287
tperovic (tp******@compumation.com) writes:
Using SS2K, I'm getting the following error while bulk inserting:

Column 'warranty_expiration_date' cannot be modified because it is a
computed column.

Here is my bulk insert statement:

BULK INSERT dbo.TestData
FROM 'TestData.dat'
WITH (CHECK_CONSTRAINTS,
FIELDTERMINATOR='|',
MAXERRORS = 1,
FORMATFILE='TestData.fmt')

The computed column is not referenced in the format file and the data file
does not contain the computed data.


Could you provide more information, for instance a CREATE TABLE statement,
a sample data file and a sample format file that demonstrates the problem.

To wit, I created this table:

create table c (a int NOT NULL,
b as sqrt(a))

And I created this format file:

8.0
1
1 SQLCHAR 0 0 "\r\n" 1 dda_num ""

And used this data file:

12
4144
356

And this command:

bulk insert c FROM 'E:\temp\slask.bcp'
WITH (CHECK_CONSTRAINTS,
FIELDTERMINATOR='|',
MAXERRORS = 1,
FORMATFILE='E:\temp\slask.fmt')

And my load was successful.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Facing a deadline, I dropped the computed column and added it to a view.
Maybe later we can revisit this issue. Thanks.

"Erland Sommarskog" <so****@algonet.se> wrote in message
news:Xn*********************@127.0.0.1...
tperovic (tp******@compumation.com) writes:
Using SS2K, I'm getting the following error while bulk inserting:

Column 'warranty_expiration_date' cannot be modified because it is a
computed column.

Here is my bulk insert statement:

BULK INSERT dbo.TestData
FROM 'TestData.dat'
WITH (CHECK_CONSTRAINTS,
FIELDTERMINATOR='|',
MAXERRORS = 1,
FORMATFILE='TestData.fmt')

The computed column is not referenced in the format file and the data file does not contain the computed data.


Could you provide more information, for instance a CREATE TABLE statement,
a sample data file and a sample format file that demonstrates the problem.

To wit, I created this table:

create table c (a int NOT NULL,
b as sqrt(a))

And I created this format file:

8.0
1
1 SQLCHAR 0 0 "\r\n" 1 dda_num ""

And used this data file:

12
4144
356

And this command:

bulk insert c FROM 'E:\temp\slask.bcp'
WITH (CHECK_CONSTRAINTS,
FIELDTERMINATOR='|',
MAXERRORS = 1,
FORMATFILE='E:\temp\slask.fmt')

And my load was successful.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by akej via SQLMonster.com | last post: by
6 posts views Thread by pk | last post: by
16 posts views Thread by Philip Boonzaaier | last post: by
3 posts views Thread by Davy B | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.