Re: SQLSTATE = 23000 error

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 07/01/04


Date: Thu, 1 Jul 2004 21:01:09 +0530

hi ylona,

First off, this is SQL Server forum, you may find some relevent Sybase forum
on the net. But looking at the error description its obvious that you are
getting primary key constraint violation error whose reason is same across
any RDBMS.
The insert statement that you are running, tries to insert such a value in
the table which is duplicating value for PRIMARY KEY constraint column
(which should be unique across the table.) If this constraint is broken you
will get this error.

Refer to following url to know more about primary keys.

http://www.schemamania.org/jkl/booksonline/SQLBOL70/html/8_des_04_13.htm

to know the primary key of the table slc_order in SQL Server i will use
following system stored procedures.

--1)
sp_pkeys table_name
--or
--2)
sp_help table_name

you will have to find out equivalent command in Sybase.

-- 
Vishal Parkar
vgparkar@yahoo.co.in | vgparkar@hotmail.com


Relevant Pages

  • Re: Clustered Index question
    ... Columnist, SQL Server Professional ... If I keep the primary key, ... >select packet_time,packet_data from packet where ... >have the clustered index (either on PACKET_TIME or on ...
    (microsoft.public.sqlserver.programming)
  • A pk is *both* a physical and a logical object.
    ... Primary key is a logical constraint. ... but SQL Server does not allow you to create a unique or primary ... constraints) by indexing is purely *platform dependent*. ... PKs are part of the ANSI SQL standard *for db implementations*. ...
    (comp.databases.theory)
  • Re: Clustered Index question
    ... Columnist, SQL Server Professional ... Without having primary key in the table, will it slow down the query that I ... the clustered index on PACKET_TIME, and instead have a clustered index on ...
    (microsoft.public.sqlserver.programming)
  • Re: Table Design Advice
    ... I will be creating db in SQL server though. ... MaterialCost (Currency) ... CONSTRAINT pk_products PRIMARY KEY, ...
    (microsoft.public.sqlserver.setup)
  • Re: Clustered Index question
    ... Columnist, SQL Server Professional ... PACKET_CONTRACT,PACKET_TIME resulted in the fastest query. ... > SQL Server MVP ... even though I never query for the primary key column? ...
    (microsoft.public.sqlserver.programming)