Click here to Skip to main content
16,006,442 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to convert to Float Pin
Colin Angus Mackay6-May-05 22:23
Colin Angus Mackay6-May-05 22:23 
GeneralRe: How to convert to Float Pin
Yulianto.8-May-05 16:23
Yulianto.8-May-05 16:23 
Generallongblob column in MySQL database table Pin
kd83416-May-05 10:49
kd83416-May-05 10:49 
Generalmysql output parameters Pin
jetset326-May-05 8:30
jetset326-May-05 8:30 
GeneralRe: mysql output parameters Pin
jetset326-May-05 8:31
jetset326-May-05 8:31 
Generalfunction returning CRecordset Pin
scoroop6-May-05 8:02
scoroop6-May-05 8:02 
GeneralSQL Reporting Pin
vkallavi6-May-05 7:47
vkallavi6-May-05 7:47 
GeneralStored Procedure headache Pin
Vodstok6-May-05 3:14
Vodstok6-May-05 3:14 
I wrote a stored procedure to do a simple update to a table in one of my dbs:

ALTER PROCEDURE usp_cmrapprupd<br />
(@id nvarchar(50),@name int,@appr nvarchar(1))<br />
AS<br />
UPDATE approvers SET approver_identifier = @name, approved_by_approver = @appr<br />
<br />
WHERE identifier = @id


now, with the exception of @id being an nvarchar, this stored procedure is identicle to another one for another table. the only difference between the two tables is that one uses integers as the id, and the other uses nvarchars.

the update on the int table works just dandy, but the one listed about keeps giving me the following error:
Violation of PRIMARY KEY constraint 'PK_approvers'. Cannot insert duplicate key in object 'approvers'.

What is giving me a headache is how am I violating primary key constraints if i am doing an update rather than insert?


Update:
OKay, I discovered a consistancy. The table uses both identifier and approver_identifier as primary keys. If i try to update something with a single instance of identifier, it works (example, identifier 1-1 has 3, 1-1 with approver_identifier of 1, 1-1 with approver_identifier of 2, etc, i get the error. however, if i have an identifier of 4-1 and only an approver_identifier of 1, the update works)

Any ideas?
______________________
Mr Griffin, eleventy billion is not a number...WTF | :WTF:
GeneralRe: Stored Procedure headache Pin
Vodstok6-May-05 3:32
Vodstok6-May-05 3:32 
Generalmysql adding parameters in asp.net vb Pin
jetset326-May-05 3:07
jetset326-May-05 3:07 
GeneralRe: mysql adding parameters in asp.net vb Pin
Mike Ellison6-May-05 5:10
Mike Ellison6-May-05 5:10 
GeneralRe: mysql adding parameters in asp.net vb Pin
jetset326-May-05 5:19
jetset326-May-05 5:19 
GeneralRe: mysql adding parameters in asp.net vb Pin
Mike Ellison6-May-05 5:37
Mike Ellison6-May-05 5:37 
GeneralRe: mysql adding parameters in asp.net vb Pin
jetset326-May-05 5:46
jetset326-May-05 5:46 
GeneralData export to excel\csv file Pin
mansir 1235-May-05 22:26
mansir 1235-May-05 22:26 
GeneralRe: Data export to excel\csv file Pin
scoroop6-May-05 8:10
scoroop6-May-05 8:10 
GeneralRe: Data export to excel\csv file Pin
S Douglas12-May-05 0:50
professionalS Douglas12-May-05 0:50 
GeneralTwo counts of rows with different criteria Pin
Luis Alonso Ramos5-May-05 19:34
Luis Alonso Ramos5-May-05 19:34 
GeneralRe: Two counts of rows with different criteria Pin
Dan_P5-May-05 19:48
Dan_P5-May-05 19:48 
GeneralRe: Two counts of rows with different criteria Pin
Luis Alonso Ramos5-May-05 20:09
Luis Alonso Ramos5-May-05 20:09 
GeneralSQL Ternary Operator Pin
Syed Abdul Khader5-May-05 19:23
Syed Abdul Khader5-May-05 19:23 
GeneralRe: SQL Ternary Operator Pin
Colin Angus Mackay5-May-05 23:32
Colin Angus Mackay5-May-05 23:32 
GeneralRe: SQL Ternary Operator Pin
Syed Abdul Khader10-May-05 15:54
Syed Abdul Khader10-May-05 15:54 
General&quot;COM object with CLSID {10020200-EB1C-11CF-AE6E-00AA004A34D5} is either not Pin
leezardd5-May-05 9:23
leezardd5-May-05 9:23 
GeneralRe: &quot;COM object with CLSID {10020200-EB1C-11CF-AE6E-00AA004A34D5} is either not Pin
Dan_P5-May-05 20:14
Dan_P5-May-05 20:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.