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

x
?
Solved

Sybase ASE BCP In With Table with No Identity Column

Posted on 2013-10-22
1
Medium Priority
?
1,250 Views
Last Modified: 2013-10-23
Here's a fun one. I wanted to test some edge case stuff like tables that are not properly defined. When I have a bcp in for a table that has no IDENTITY column, I get an error. Here's the whole flow of things:

My table is defined like this:

CREATE TABLE [dbo].[XTABLE] (
            [BOGUSID] INT NOT NULL ,
            [DAT] DATETIME NOT NULL
)

No pk/identity.

I export its data (few rows ) in bcp with this:

bcp mytester.dbo.XTABLE out XTABLE.bcp -U sa -P mypass -T -n

now, I want to bring it back in using this:

bcp mytester.dbo.XTABLE in MyTable.bcp  -E -n -S Sybase_157 -U sa -P SyAdmin

The result says:

Server Message: Sybase157 - Msg 7756, Level 16, State 1:

Cannot use 'SET IDENTITY_INSERT' for table 'mytester.dbo.XTABLE' because the table does not have the identity property.

I have looked over the bcp page, but can't come up with some way to tell it it's ok to insert without identity column...

Any suggestions experts?
0
Comment
Question by:Jay Redd
[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
1 Comment
 
LVL 24

Accepted Solution

by:
Joe Woodhouse earned 2000 total points
ID: 39593387
This is correct and expected behaviour.

You used the "-E" switch, which means "the values in this BCP file are to be explicitly loaded into the identity column in this table".

You don't have an identity column in your table, hence your error message. "-E" implicitly issues the "set identity_insert on" command at the start of the bcp connection.

Try it without "-E". It should work, although note if your ASE versions are not the same you may run into issues, and if they are not running on the same platform (hardware and operating system) you may also run into (other) issues because "-n" means "native" or platform-dependent mode.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
The online market is growing at an unprecedented rate and retail eCommerce sales are expected to reach $4 trillion by 2020. Yet, the profit is not just there for the taking because you have to set yourself apart from the competition.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

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