Link to home
Start Free TrialLog in
Avatar of Jay Redd
Jay Redd

asked on

Sybase ASE BCP In With Table with No Identity Column

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?
ASKER CERTIFIED SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial