Anticipated PK Violation

Sep 6, 2004

I am maintaining a stored proc that does the following (pseudo code for simplicity)


INSERT INTO MyTable (CountColumn, ...) VALUES (1, ...)

-- 2627 = Primary key violation
IF (@@ERROR = 2627)
UPDATE MyTable SET CountColumn = CountColumn + 1
WHERE ...


Basically, try to create a new record with a PK and a count of 1. If a PK violation occurs, UPDATE the count of existing record.

Pretty simple logic. On some servers this works exactly as expected; the PK violation is caught and handled internally. On other servers, this error percolates out of the stored proc and causes the calling code to receive an error and fail. All servers are SQL Server 2000 SP3a Standard Edition. Any ideas why this happens?

Is there a better (and ideally as fast or faster) way to handle the INSERT/UPDATE issue? I can put the UPDATE first and INSERT if @@ROWCOUNT is 0, but that has the slight potential of a race condition where two processes try to INSERT the same PK at the same time.

View 5 Replies


ADVERTISEMENT

Access Violation

Aug 22, 2001

How execption access violation error msg with severity 19 handled in sql7 ?

Thanks for info.

View 1 Replies View Related

DTS Integrity Violation

Jun 12, 2000

I having a problem importing a text file into an existing table using the DTS import wizard. The problem I am having is, I am getting an error message stating: Integrity violation: attempt to insert null data or data which violates constraints. The column the error is referenced to is an identity field and I am not trying to insert any data into the field. I have the allow insert identity box checked in the transformation section. Does anyone know about how to solve this problem.
Thanks
James

View 1 Replies View Related

Primary Key Violation When There Is Only One Row

Feb 23, 2000

I have a table with 5 columns .Length of the 2nd column is 4 characters.
I have to create a new database and copy the existing data.Alter the 2nd column to have 6 charactrers.
Append the values in 2nd column with 00.
I have only one row in the old database.
I am able to copy the rows.But after that when I try to update,it is giving primary key violation error.
What could be the reason?

View 1 Replies View Related

Access Violation

Oct 15, 2003

System Spec: OS = Windows 2000, SQL Server 7 SP4.

I'm getting the following error when I run a stored procedure which truncates a table then inserts data into it. There are no complex joins, order, group by or union clauses in the insert statement:

Error: 0, Severity: 19, State: 0
SqlDumpExceptionHandler: Process 17 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

I've read that this is fixed in SQL 7 SP2 but we're on SP4?? I have re-installed SQL SP4.

View 1 Replies View Related

Primary Key Violation ???????

Apr 8, 1999

I am running SQL 6.5 service pack 5a.

I keep getting a Attempt to insert duplicate key row in object... when I try to add a record. I know for a fact that the primary key is not being duplicated because I can look in the db and see that it is not there and if I continue to try to add it it will eventually succeed. Does anyone know what might be causing this?

Please email as well as post.

Thanks.
Carole

View 2 Replies View Related

Primary Key Violation

Jul 14, 2004

Hi,
I have got a very peculier kind of problem. My package is running on SQL 2000. There is a identity primary key in a table. Now when I submit the data from 2 different computer at the same time. Only one data is storing. The reason behind this is the primary key violation. as both the data are sending the request to the database at the same time.................n as the primary key is th identity column, it is storing one that value which is able to store the data at the forst hand.
Now plz help me out in this regard................. :confused:

View 11 Replies View Related

Violation Of Primary Key

Mar 30, 2008

Violation of PRIMARY KEY constraint 'PK_CUSTOM2'. Cannot insertduplicate key in object 'MHGROUP.Custom2'Is there ANY other reason this violation of the primary key wouldhappen OTHER than a trying to insert a duplicate record?This sql statement false due to the primary key violation:Insert Into MHGROUP.Custom2SelectClientNumber,MatterNumber,MatterDescription,'Y'From MG_EliteMatters EMLeft Outer Join MHGROUP.Custom2 C2On C2.CPARENT_ALIAS = EM.ClientNumberAnd C2.Custom_ALIAS = EM.MatterNumberWhere CPARENT_ALIAS Is Null And Custom_ALIAS Is Null---Custom2CREATE TABLE [MHGROUP].[CUSTOM2]([CPARENT_ALIAS] [varchar](32) COLLATE SQL_Latin1_General_CP1_CI_ASNOT NULL,[CUSTOM_ALIAS] [varchar](32) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL,[C_DESCRIPT] [varchar](254) COLLATE SQL_Latin1_General_CP1_CI_ASNULL,[ENABLED] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,CONSTRAINT [PK_CUSTOM2] PRIMARY KEY CLUSTERED([CPARENT_ALIAS] ASC,[CUSTOM_ALIAS] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]--MG_EliteMattersCREATE TABLE [dbo].[MG_EliteMatters]([Matters] [varchar](16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,[ClientNumber] [varchar](32) COLLATE SQL_Latin1_General_CP1_CI_ASNULL,[ClientDescription] [varchar](254) COLLATESQL_Latin1_General_CP1_CI_AS NULL,[MatterNumber] [varchar](32) COLLATE SQL_Latin1_General_CP1_CI_ASNULL,[MatterDescription] [varchar](254) COLLATESQL_Latin1_General_CP1_CI_AS NULL,[LastDateModified] [datetime] NULL,[PracticeArea] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_ASNULL) ON [PRIMARY]

View 1 Replies View Related

Key Violation During Synchronization

Sep 10, 2006

Dear Friends

I restored same database in Publisher & subscriber.If I want to apply Transactional replication I have to apply initial snapshot.then I am getting key-violation problems during initialization .Some times Primary key table will be dropped before foreign key table.sometimes it won't able to drop some indexes.This I am getting if I am going for all tables of database.But here i need all tables.If I am going for selective table I don't have any problem.For avoiding this problem I tried all the options in table article option in publication wizard.But some na some key violation I am getting always.So please give me some better suggestion

Thanks in Advance

Filson

View 5 Replies View Related

Violation Of PRIMARY KEY

Sep 14, 2007

Jobs run at 1 am , sometimes fail with following error.

Violation of PRIMARY KEY constraint 'PK__xxxxx__300424B4'. Cannot insert duplicate key in object 'VW_xxxx . [SQLSTATE 23000] (Error 2627) The statement has been terminated. [SQLSTATE 01000] (Error 3621). The step failed.

when I am reruning 7 am job run successfully. Any advice will be great.

Thanks

View 11 Replies View Related

Primary Key Violation

Oct 7, 2006

Dear Friends,
I am a DBA and I am getting a lot of table locks due to unhandled errors in front-end developed by Power Builder, 5 years back. The backend is SQL Server 2000 Enterprise edition. Below I will explain the problem in detail.

The Big Problem.
{
Ø Users enter sales data into rm_salehdr (docid,..,..,..) table (LOCKED)
Ø The rm_salehdr table need a new docid
Ø The new docid will be generated by a function called as docnogen
Ø The docnogen function
o will select the last docid from ps_docno table
o add 1 to last value
o return docid to rm_salehdr
o update the last docid with the new value.
o ps_docno table will hold the lock till the insert transaction of rm_salehdr will saved. (LOCKED)
Ø If insert into rm_salehdr commit then the insert into ps_docno will be commit. (LOCK Released)
Ø If insert into rm_salehdr rolled back then insert into ps_docno will be rolled back.
Ø (LOCK Released)

}

The Bigger Problem
{
Ø At the same time if another spid select the last docno and completes it transaction before the first transaction then Primary key Violation will arise.
Ø While inserting into rm_salehdr if a user get a error due to primary key violation then user will popped up with a message box explaining the primary key violation error.
Ø If the user does not click the OK button then the transaction will not be ended and LOCK on the table will not released from rm_salehdr.
Ø The LOCK on ps_docno will also be continued.
}

The Biggest Problem
{

Ø My client doesn€™t want to modify the front-end, it is very expensive for them and deployment to remote site is also a problem for them.
Ø They want me to handle it from the backend.
}


Is it possible that to handle the error message and release the lock on rm_salehdr from backend.

Commit the data first in ps_docno so lock will be released
I want your valuable suggestions and advice.

Thanks in advance.
Regards,
Raj



View 4 Replies View Related

Violation Of PRIMARY KEY Constraint

Mar 23, 2005

Hi,
I am trying to insert into a table. I got the above error message then I deleted all the data in the table. But I am still getting this error.

Whats wrong?

View 2 Replies View Related

Violation Of Primary Key Error

Dec 13, 2005

hi,
I am trying to save the record which is displayed in the textbox by selecting a row in the datagrid. If i click the save button I am getting the following error.
Violation of PRIMARY KEY constraint 'PK_clientinfo'. Cannot insert duplicate key in object 'clientinfo'. The statement has been terminated.      
button save-----------
    conn.Open();    SqlCommand cmd = new SqlCommand("insert into clientinfo (client_name, address, telephone, fax, email, contperson1, dept, contpos1, contperson2, contpos2, rscompname, rscontperson, rsposition, actdate, acttime, instsno, actkey) values ('"+txtclientname.Text+"', '"+txtaddress.Text+"', '"+txttelephone.Text+"', '"+txtfax.Text+"', '"+txtemail.Text+"', '"+txtcntperson1.Text+"', '"+txtdept.Text+"', '"+txtcnt1pos.Text+"', '"+txtcntperson2.Text+"', '"+txtcnt2pos.Text+"', '"+txtcompname.Text+"', '"+txtrscntperson.Text+"', '"+txtrspos.Text+"', '"+txtactdate.Text+"', '"+txtacttime.Text+"','"+txtinstno.Text+"', '"+txtactkey.Text+"')", conn);    cmd.ExecuteNonQuery();    conn.Close();    BindData();    txtclear();       } 

View 1 Replies View Related

Concurrency Violation Error!

May 16, 2006

Hiim keep getting  the following errorConcurrency violation: the UpdateCommand affected 0 recordsI dunno whats wrong, im the only person using the database and program at the moment.Anyone know what im doing wrong?thanks 

View 1 Replies View Related

Access Violation In Sql Server

Sep 22, 2000

Hi,
I received this event in my eventlog

Error: 0, Severity: 19, State: 0
SqlDumpExceptionHandler: Process 6 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

What could be the cause of this??

Thanks in advance
Mikael

View 3 Replies View Related

ERROR MSG: Violation Of PRIMARY KEY

Apr 30, 1999

Hi,

On a regular basis, it seems that the primary key of my table gets corrupted and I get the error message below. I can still read the data but no longer update or insert.
There is no reason why there should be such error. I fix it by creating a temporary table and copying the data accross, then renaming the
table, but I would rather prevent it. Any thought on this??


<P>ODBC Error Code = 23000 (Integrity constraint violation)
<P>[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'PK___1__23': Attempt to insert duplicate key in object 'SiteList'

View 1 Replies View Related

How Do You Find A Primary Key Violation

Jan 11, 2005

I need to find out which record I am violating by trying to execute this stored procedure

ALTER PROCEDURE InsertCorovan2004
AS
INSERT INTO [GamingCommissiondb].[dbo].[Corovan_Table]
([TM #],
[FirstName],
[LastName],
[SS #],
[TerminationDate],
[Voluntary or Involuntary])

SELECT [TM #], FirstName, LastName, SocialSecurityNumber, TerminationDate, VoluntaryorInvoluntary
FROM dbo.TERMINATION
WHERE (TerminationDate BETWEEN CONVERT(DATETIME, '2004-01-31 00:00:00', 102) AND CONVERT(DATETIME, '2004-12-31 00:00:00', 102))

GO



when I execute it I get this error message
Server: Msg 2627, Level 14, State 1, Procedure InsertCorovan2004, Line 3
Violation of PRIMARY KEY constraint 'PK_Corovan_Table'. Cannot insert duplicate key in object 'Corovan_Table'.
The statement has been terminated.
Stored Procedure: GamingCommissiondb.dbo.InsertCorovan2004
Return Code = -4


I am trying to insert 2004 terms into the corovan table from TERMINATION table. How do you find out what records match from each table (compare the tables reocords for dups). How would I do this in the query analyzer since thats mainly what I use. I get a better understanding of how to create proceudure in the query analyzer so I;d rather stick to it.

In short I need to find the Culprit record that is preventing me from insert the 2004 records


Thank you

View 14 Replies View Related

Violation Of PRIMARY KEY Constraint

Sep 21, 2005

I know what this error means is that you can not insert duplicate primary keys in the table but the thing is I am checking the rows if they do not exist then insert otherwise don't do any thing these are the lines I am writing in my strored procedure can someone please let me know what I am doing wrong here.

If not exists
(Select * From GGP WHERE
FFECTIVE_DATE =@v_EFFECTIVE_DATE AND
ASSET_ID= @v_ASSET_ID AND
ASSET_TYPE = @v_ASSET_TYPE AND
Value = @v_Value AND
hour = @v_Hour)

INSERT INTO GGP
(ASSET_ID,ASSET_TYPE,Hour,Value,EFFECTIVE_DATE) values(@v_ASSET_ID,@v_ASSET_TYPE,@v_Hour,@v_Value, @v_EFFECTIVE_DATE)



The exact error is
Violation of PRIMARY KEY constraint 'PK_SP_GGP'. Cannot insert duplicate key in object

Thanks in advance.

View 7 Replies View Related

Violation Of PRIMARY KEY Constraint

Apr 10, 2006

When I try to insert data into a table (let's just call it MyTable for this post), I suddenly get the following error.

Violation of PRIMARY KEY constraint 'PK_MyTable'. Cannot insert duplicate key in object 'MyTable'.

My table does have a primary key field named 'id', which is an auto-incrementing BIGINT. The last record I successfully inserted received 14 in the id field, so I'm assuming the database is trying to assign 15 to the next. Unfortunately, there is already a record with an id of 15; the next available id is 21.

Is there a way to avoid these primary key collisions?

View 5 Replies View Related

Primary Key Violation Error

Apr 8, 2008

Can anyone help me in handling errors I'm trying to update Employee master table, but i get error messege of violating primary-key constraint

View 3 Replies View Related

Violation Of Primary Key Constraint

Mar 3, 2006

I'm trying to insert records into a table and getting the below error and not sure how to resolve it:

Server: Msg 2627, Level 14, State 1, Line 1
Violation of PRIMARY KEY constraint 'PK_propertyItem'. Cannot insert duplicate key in object 'propertyItem'.
The statement has been terminated.

View 2 Replies View Related

Access Violation Problem - Need Help

Jun 18, 2007

I have a task i.e. to make the following query work.
But it shows me syntax error. I dont know what this query is doing and I have no concerns about it. so if any body could help me out that will be a big help :)

SHAPE {

SELECT * FROM Leads
WHERE 1=1
AND ( ([Lead Quality] NOT IN (1,5,6,7) )
AND ( idVendors = '{ADF4406A-ACB7-4610-A03F-702D86CC259F}' )
AND ( idLeads IN (select idleads from [vendors history] where status = 3) )
AND ( [received datetime] between '6/18/2007' AND '6/19/2007' )
AND ( [Lead Type] NOT IN (7,8) )
)
ORDER BY idVendors, [Customer ID]

}
AS [Leads Detail]

APPEND

( { SELECT * FROM [Leads Borrower Information] WHERE [CoBorrower Indicator] = 0 } As [Borrower Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Leads Borrower Information] WHERE [CoBorrower Indicator] = 1 } AS [CoBorrower Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Leads Property Information] WHERE [Mailing Address Indicator] = 0 } As [Property Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Leads Property Information] WHERE [Mailing Address Indicator] = 1 } AS [Mailing Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Leads Mortgage Information] WHERE [Mortgage Indicator] IN (0,1) } AS [First Mortgage Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Leads Mortgage Information] WHERE [Mortgage Indicator] = 2 } AS [Second Mortgage Information] RELATE 'idLeads' TO 'idLeads'),
( { SELECT * FROM [Vendors] } As [Vendor Information] RELATE 'idVendors' to 'idVendors'),
( { SELECT * FROM [Lead Quality Reason Values] } As [Return Reason] RELATE 'Lead Quality Reason' to 'Value'),
( { SELECT [Batch ID], idLeads, idVendorsOrders FROM [Vendors History] WHERE STATUS IN (1,2) } As [Vendor History] RELATE 'idLeads' to 'idLeads'),
( { SELECT TOP 1 idLeads, DateTime from [Clients History] WHERE Status IN (3) ORDER BY DateTime ASC } As [Clients History] RELATE 'idLeads' to 'idLeads')

View 3 Replies View Related

VIOLATION OF PRIMARY KEY CONSTRAINT

Feb 15, 2008

Violation of PRIMARY KEY constraint 'PK_tbl_others. Cannot insert duplicate key in object 'tbl_others.
The statement has been terminated.-- What does it mean i cant load the data to tbl_others

View 2 Replies View Related

Violation Of Primary Key Constraint

Apr 2, 2007

When replication merge, is taking place between two servers on one particular table I keep getting violation of primary key constraint, Does anyone out there have a fix for this?

View 1 Replies View Related

'check Constraint' Ignored - PK Violation

Jul 24, 2007

I thought the whole point of 'check constraint' being unticked meant you could whack your data straight in no probs.

How can I insert a bunch of historical information where I want to control the PK, in this case DealID?

I have got 'keep identity' checked.

I check the db, the Id does NOT exist currently.


Error: 0xC0202009 at Data Cleansing, Deal Insert [12194]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_DealID'. Cannot insert duplicate key in object 'dbo.Deal'.".

View 3 Replies View Related

Violation Of Primary Key Constraint

Jan 4, 2008

Hi,

I've a set of source tables on one server and a set of destination tables on another.
When I move data from one server to next, I get an error saying "Violation of Primary Key Constraint". This happens for only one table among the 6 tables that I have. I dont understand why it throws me this error. Though theres an error for this table, the data from source table moves into this destination table.

Am I missing something?


Thanks,
Subha Fernando

View 7 Replies View Related

Violation Of Primary Key Constraint

Jan 4, 2008


Hi,

I've a set of source tables on one server and a set of destination tables on another. I'm moving this using a data flow task.
When I move data from one server to next, I get an error saying "Violation of Primary Key Constraint". This happens for only one table among the 6 tables that I have. I dont understand why it throws me this error. Though theres an error for this table, the data from source table moves into this destination table.

Am I missing something?


Thanks,
Subha Fernando

View 5 Replies View Related

InsertCommand.ExecuteNonQuery() And Violation Of PrimaryKey

Jan 15, 2007

Hey,
I have a page that inserts into a customers table in the DataBase a new customer account using this function:
Public Function InsertCustomers(ByRef sessionid, ByVal email, ByVal pass, Optional ByVal fname = "", Optional ByVal lname = "", Optional ByVal company = "", Optional ByVal pobox = "", Optional ByVal add1 = "", Optional ByVal add2 = "", Optional ByVal city = "", Optional ByVal state = "", Optional ByVal postalcode = "", Optional ByVal country = 0, Optional ByVal tel = "")
Dim result As New DataSet
Dim tempid As Integer
Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("Conn"))
Dim Adcust As New SqlDataAdapter
Adcust.InsertCommand = New SqlCommand
Adcust.SelectCommand = New SqlCommand
Adcust.InsertCommand.Connection = conn
Adcust.SelectCommand.Connection = conn
sessionExists(email, sessionid, 1)
conn.Open()
If fname = "" Then
Adcust.InsertCommand.CommandText = "Insert Into neelwafu.customers(email,password,sessionid) Values('" & email & "','" & pass & "','" & sessionid & "')"
Else
Dim strsql As String
strsql = "Insert Into neelwafu.customers"
strsql = strsql & "(sessionid,email,password,fname,lname,company,pobox,address,address2,city,state,postalcode,countrycode,tel) values("
strsql = strsql & "'" & sessionid & "','" & email & "','" & pass & "','" & fname & "','" & lname & "','" & company & "','" & pobox & "','" & add1 & "','" & add2 & "','" & city & "','" & state & "','" & postalcode & "', " & country & ",'" & tel & "')"
Adcust.InsertCommand.CommandText = strsql
End If
Adcust.InsertCommand.ExecuteNonQuery()
Adcust.SelectCommand.CommandText = "Select Max(id) from neelwafu.Customers"
tempid = CInt(Adcust.SelectCommand.ExecuteScalar())
conn.Close()
Return tempid
End Function
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Now, I am getting an error:
Violation of PRIMARY KEY constraint 'PK_customers_1'. Cannot insert duplicate key in object 'customers'. The statement has been terminated.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The customers table has as a primary key the 'email'.....
so plz can I know why am I getting this error ????
Thank you in advance
Hiba

View 4 Replies View Related

Capture Primary Key Violation Error

Sep 14, 2007

Hello,,
I need to capture the primary key violation error:
        If e.CommandName = "Insert" Then            Dim EmployeeIDTextBox As TextBox = CType(dvContact.FindControl("EmployeeIDTextBox"), TextBox)            Dim LastName As TextBox = CType(dvContact.FindControl("LastName"), TextBox)            Dim FirstName As TextBox = CType(dvContact.FindControl("FirstName"), TextBox)     
            Using cmdAdd As New System.Data.SqlClient.SqlCommand
                'Establish connection to the database connection                Dim sqlcon As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("eConnString").ToString)
                'Open connection                sqlcon.Open()
                'Pass opened connection (see above) to the command object                cmdAdd.Connection = sqlcon
                'Using "With/End With" pass content to columns from text objects and datatime variables (see above)                With cmdAdd                    .Parameters.Add(New SqlClient.SqlParameter("@EmployeeID", EmployeeIDTextBox.Text))                    .Parameters.Add(New SqlClient.SqlParameter("@LastName", LastName.Text))                    .Parameters.Add(New SqlClient.SqlParameter("@FirstName", FirstName.Text))                              'Establish the type of commandy object                    .CommandType = CommandType.Text
                    'Pass the Update nonquery statement to the commandText object previously instantiated                    .CommandText = "INSERT INTO ATTEmployee(EmployeeID, LastName, FirstName & _                         "VALUES (@EmployeeID, @LastName, @FirstName)"                End With
                'Execute the nonquerry via the command object                cmdAdd.ExecuteNonQuery() '<==Need to capture primaryKey violation, give user message, cancel insert,return to detailView ReadOnly
               'I haven't figured out the correct code to capture the primary key violation
               EDITMsg.Text="You can not insert an duplicate record.  Try Again."
                'Close the sql connection                sqlcon.Close()            End Using        End If
 
Thank you for your help

View 6 Replies View Related

Contraint Violation When Reading From Database

Apr 4, 2008

I have created a typed-dataset AuthorsDataSet and created a table in with name Authors, manually by right-click > New > Table. I have kept the data-types, sizes and contstriants exactly same as the table in the database, though I have kept the Column names different. I am filling the AuthorsDataSet with the following code on Form_Loadif (!IsPostBack)
{      SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["pubsConnectionString"].ConnectionString);
      SqlCommand cmd = new SqlCommand("SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors", conn);      using (SqlDataAdapter da = new SqlDataAdapter(cmd))
      {
            conn.Open();
            da.Fill(ds.Authors);
            grdAuthors.DataSource = ds.Authors;
            grdAuthors.DataBind();
            conn.Close();
      }
      conn.Dispose();
      cmd.Dispose();
}
The connection string is as follows:<connectionStrings>
      <add name="pubsConnectionString" connectionString="Data Source = localhost; Initial Catalog = pubs; Integrated Security = SSPI"/>
</connectionStrings>
The following error occurs when I run the page
System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

View 3 Replies View Related

Results Coming Through In Violation Of Criterion

Mar 6, 2002

I'm baffled by the results of the following query:
__________________________________________________ ______
select events.[report number], [microfilm number], [crash date]
into lowspeed
from events inner join vehicles
on events.[report number] = vehicles.[report number]
where [dummy record] = 'N'
and [estimated mph] between 1 and 10
and ([1st harmful event] = 01
or [2nd harmful event] = 01)
and [type of vehicle] in
('01','02','03','04','05','06','07','08','10','11' ,'12')
and [crash injury severity] = 5

select events.[report number], [microfilm number], [crash date]
into notlowspeed
from events inner join vehicles
on events.[report number] = vehicles.[report number]
where [dummy record] = 'N'
and [estimated mph] > 10
and ([1st harmful event] = 01
or [2nd harmful event] = 01)
and [type of vehicle] in
('01','02','03','04','05','06','07','08','10','11' ,'12')
and [crash injury severity] = 5

select distinct [report number], [microfilm number], [crash date]
into truelowspeed
from lowspeed where [report number] not in (select [report number] from
notlowspeed)

select [report number]
into pedtable
from pedestrians

select [report number],[microfilm number], [crash date]
as [Lowspeed Fatal Crashes - 1994]
from truelowspeed
where [report number] not in (select [report number] from pedtable)

drop table pedtable
drop table truelowspeed
drop table lowspeed
drop table notlowspeed
_______________________________________________

Let me explain what I'm trying to do.

In the first temp table "lowspeed," I'm trying to lump all crashes where a vehicle was doing between 1 and 10 mph.
In "notlowspeed," I'm setting up a table of crashes in which at least one vehicle was going over 10 mph.
By the third gyration, I'm trying to generate "truelowspeed;" which I thought would contain only crashes in which all of the criterion in the first two queries were satisfied and all of the vehicles involved in the crashes were doing between 1 and 10 mph (NO vehicles exceeding the 1 to 10 mph parameter).
The "pedtable" maneuver is simply to pull out any of these crashes in which a pedestrian was involved.
What I'm getting is a lot of crashes in which I have dummy records, several crashes in which one of the vehicles was going over 10 mph, and types of vehicles involved in the crash that should have been excluded by the criterion I specified.

Thoroughly stumped. Would be most grateful for any kind insight/advice.

View 2 Replies View Related

Access Violation When Selecting Data

Dec 6, 2005

Hi,

I have suddenly developed a problem when trying to select from a table. Even a standard select * from generates a SQL Dump exception handler. The table is below:

CREATE TABLE [Stagetb_GIDeptGroup] (
[f_GIImportID] [int] IDENTITY (1, 1) NOT NULL ,
[f_GIAction] [int] NOT NULL CONSTRAINT [DF_stagetb_GIDeptGroup_f_GIAction] DEFAULT (0),
[f_ImportBatchID] [int] NULL ,
[f_VisualDeptGroupID] [int] NULL ,
[f_DeptGroupName] [varchar] (40) COLLATE Latin1_General_CI_AS NULL ,
[f_DeptGroupTarget] [d_Percentage] NULL ,
[f_ExternalDeptGroupID] [int] NULL ,
[f_StatusID] [int] NOT NULL CONSTRAINT [DF_stagetb_GIDeptGroup_f_StatusID] DEFAULT (0),
[f_StatusDetailID] [int] NOT NULL CONSTRAINT [DF_stagetb_GIDeptGroup_f_StatusDetailID] DEFAULT (0),
CONSTRAINT [PK_stagetb_GIDeptGroup] PRIMARY KEY CLUSTERED
(
[f_GIImportID]
) ON [PRIMARY]
) ON [PRIMARY]
GO

When i run a dbcc checkdb it finds nothing, if i try and connect from a remote connection i get a general network error and when connecting from the local machine i get this Dump exception error:

2005-12-06 08:40:55.28 spid53 Error: 0, Severity: 19, State: 0
2005-12-06 08:40:55.28 spid53 language_exec: Process 53 generated an access violation. SQL Server is terminating this process..
2005-12-06 08:40:57.76 spid53 Using 'sqlimage.dll' version '4.0.5'
Stack Dump being sent to C:Program FilesMicrosoft SQL ServerMSSQLlogSQL00010.dmp
2005-12-06 08:40:57.76 spid53 Error: 0, Severity: 19, State: 0
2005-12-06 08:40:57.76 spid53 SqlDumpExceptionHandler: Process 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process..
************************************************** *****************************
*
* BEGIN STACK DUMP:
* 12/06/05 08:40:57 spid 53
*
* Exception Address = 00425E61
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
* Access Violation occurred reading address 00000000
* Input Buffer 70 bytes -
* select * from stagetb_GIDeptGroup
*
*
* MODULE BASE END SIZE
* sqlservr 00400000 00B19FFF 0071a000
* ntdll 77F50000 77FF6FFF 000a7000
* kernel32 77E60000 77F45FFF 000e6000
* ADVAPI32 77DD0000 77E5CFFF 0008d000
* RPCRT4 78000000 78085FFF 00086000
* USER32 77D40000 77DC5FFF 00086000
* GDI32 7E090000 7E0D0FFF 00041000
* OPENDS60 41060000 41065FFF 00006000
* MSVCRT 77C10000 77C62FFF 00053000
* UMS 41070000 4107CFFF 0000d000
* SQLSORT 42AE0000 42B6FFFF 00090000
* MSVCIRT 002A0000 002AFFFF 00010000
* sqlevn70 41080000 41086FFF 00007000
* NETAPI32 71C20000 71C6DFFF 0004e000
* wmi 76D30000 76D33FFF 00004000
* SSNETLIB 42CF0000 42D05FFF 00016000
* WSOCK32 71AD0000 71AD7FFF 00008000
* WS2_32 71AB0000 71AC4FFF 00015000
* WS2HELP 71AA0000 71AA7FFF 00008000
* SSNMPN70 410D0000 410D5FFF 00006000
* security 71F80000 71F83FFF 00004000
* SECUR32 76F90000 76F9FFFF 00010000
* crypt32 762C0000 76347FFF 00088000
* MSASN1 762A0000 762AFFFF 00010000
* VERSION 77C00000 77C06FFF 00007000
* userenv 75A70000 75B14FFF 000a5000
* mswsock 71A50000 71A8AFFF 0003b000
* DNSAPI 76F20000 76F44FFF 00025000
* winrnr 76FB0000 76FB6FFF 00007000
* WLDAP32 76F60000 76F8BFFF 0002c000
* rasadhlp 76FC0000 76FC4FFF 00005000
* wshtcpip 71A90000 71A97FFF 00008000
* SSmsLPCn 42CD0000 42CD6FFF 00007000
* ntdsapi 767A0000 767B2FFF 00013000
* msv1_0 76D10000 76D2CFFF 0001d000
* OLE32 771B0000 772D0FFF 00121000
* CLBCATQ 76FD0000 77047FFF 00078000
* OLEAUT32 77120000 771AAFFF 0008b000
* COMRes 77050000 77114FFF 000c5000
* sqloledb 01D80000 01DF2FFF 00073000
* MSDART 74C50000 74C6EFFF 0001f000
* COMCTL32 77340000 773CAFFF 0008b000
* comdlg32 763B0000 763F4FFF 00045000
* SHLWAPI 70A70000 70AD4FFF 00065000
* SHELL32 773D0000 77BC1FFF 007f2000
* MSDATL3 60E30000 60E44FFF 00015000
* comctl32 71950000 71A33FFF 000e4000
* oledb32 02020000 02084FFF 00065000
* OLEDB32R 01E00000 01E0FFFF 00010000
* xpsqlbot 42F00000 42F05FFF 00006000
* xpstar 410F0000 41133FFF 00044000
* SQLUNIRL 5C1B0000 5C1DCFFF 0002d000
* WINSPOOL 73000000 73022FFF 00023000
* SQLRESLD 42AC0000 42AC6FFF 00007000
* SQLSVC 42C40000 42C56FFF 00017000
* ODBC32 02150000 02181FFF 00032000
* odbcbcp 02190000 02195FFF 00006000
* W95SCM 41140000 4114BFFF 0000c000
* NDDEAPI 75940000 75946FFF 00007000
* odbcint 022B0000 022C5FFF 00016000
* clusapi 55560000 55570FFF 00011000
* resutils 750B0000 750C0FFF 00011000
* SQLSVC 43970000 43975FFF 00006000
* xpstar 439E0000 439EBFFF 0000c000
* DBGHELP 02420000 02432FFF 00013000
* msdbi 6BE90000 6BEABFFF 0001c000
* sqlimage 4A400000 4A40CFFF 0000d000
*
* Edi: 1ADA13F4: 00000000 1ADA1758 00000000 1ADA1400 00000001 00000000
* Esi: 00000000:
* Eax: 1ADA13E0: 009802E4 00000032 00000000 00000000 00000000 00000000
* Ebx: 1ADA13E0: 009802E4 00000032 00000000 00000000 00000000 00000000
* Ecx: 00000000:
* Edx: 1ADA1410: 00000000 6E006100 00000000 00000000 00000000 1ADA0030
* Eip: 00425E61: 7589018B 8B10FFFC F44D8BF0 A5A5A5A5 5EC38B5F 0D89645B
* Ebp: 0213DFE8: 0213E01C 004C4EB7 1ADA0020 00000000 1ADA1168 1ADC84D0
* SegCs: 0000001B:
* EFlags: 00010282: 0050004F 00300048 00300033 00560030 004F0042 004E0000
* Esp: 0213DFCC: 1ADA07F0 1ADA0020 00A0A4A0 1ADA13E0 0213E010 0092D7B0
* SegSs: 00000023:
************************************************** *****************************
-------------------------------------------------------------------------------
Short Stack Dump
00425E61 Module(sqlservr+00025E61)
004C4EB7 Module(sqlservr+000C4EB7)
0049DCD9 Module(sqlservr+0009DCD9)
0049DAF9 Module(sqlservr+0009DAF9)
00447078 Module(sqlservr+00047078)
004510FE Module(sqlservr+000510FE)
00415080 Module(sqlservr+00015080)
004592CE Module(sqlservr+000592CE)
005A7208 Module(sqlservr+001A7208) (SQLExit(unsigned long)+000523F6)
005A7099 Module(sqlservr+001A7099) (SQLExit(unsigned long)+00052287)
00446A83 Module(sqlservr+00046A83)
004510FE Module(sqlservr+000510FE)
00415080 Module(sqlservr+00015080)
004592CE Module(sqlservr+000592CE)
0041534F Module(sqlservr+0001534F)
00459A54 Module(sqlservr+00059A54)
004175D8 Module(sqlservr+000175D8)
410735D0 Module(UMS+000035D0) (UmsSystemUserContext::UmsSystemUserContext(class UmsScheduler *,struct UMS_SYSPARAMS *)+00000434)
4107382C Module(UMS+0000382C) (UmsScheduler::FiberEnabled(void)+000001D2)
77C37E53 Module(MSVCRT+00027E53) (_endthread+000000AA)
77E7D33B Module(kernel32+0001D33B) (RegisterWaitForInputIdle+00000043)

I am running Windows XP Professional & MSDE Service Pack 3. Any ideas anyone?

View 1 Replies View Related

Primary Key Violation Error In SQL 2005

Oct 17, 2006

Hey guys...

I've recently migrated a SQL 2000 db to SQL 2005. There is a table with a defined primary key. In 2000 when I try importing a duplicate record my application would continue and just skip the duplicates. In 2005 I get an error message "Cannot insert duplicate key row in object ... with unique index..." Is there a setting that I can enable/disable to ignore and continue processing when these errors are encountered? I've read a little on "fail package on step failure" but not quite clear on it. Any tips? Thanks alot

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved