Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Help!
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 11038 of 11517
Post > Topic >>

Help!

by papa smurf <DSOldham@[EMAIL PROTECTED] > May 13, 2008 at 07:43 PM

Hello folks.  I am somewhat new to the SQL World, but have a basic
understanding of the language.  I have a table that I am trying to
update, and not having much success with it.  The table has three keys
and one foreign key.  I cannot find the table the houses the foreign
key as there is so many to look through.  I will leave my error
message below, along with my SQL syntax for your review.  Any
assistance with this issue is much appreciated!

(51 row(s) affected)

(51 row(s) affected)

(51 row(s) affected)
Msg 2627, Level 14, State 1, Line 15
Violation of PRIMARY KEY constraint 'PK_TIAHours'. Cannot insert
duplicate key in object 'TIATotals'.
The statement has been terminated.

(0 row(s) affected)

Select *
into ##Temp
From dbo.TIATotals
where AssociateNumber = '91060139'
and DeptIndex = 0

Update ##Temp set
DeptIndex = 1 where AssociateNumber = '91060139'
and DeptIndex = 0

Delete From TiaTotals
where AssociateNumber = '91060139'
and DeptIndex = 0

Insert Into TiaTotals (AssociateNumber,DeptIndex,RecordDate,
ActualMinutes,CorrectedMinutes,BreakAdjust,
RcdCreateUser,RcdUpdtUser,RcdCreateDateTime,RcdUpdtDateTime)
Select AssociateNumber,DeptIndex,RecordDate,
ActualMinutes,CorrectedMinutes,BreakAdjust,
RcdCreateUser,RcdUpdtUser,RcdCreateDateTime,RcdUpdtDateTime From
##Temp

Drop Table ##Temp

Select *
From dbo.TIATotals
where AssociateNumber = '91060139'
and DeptIndex = 0
 




 2 Posts in Topic:
Help!
papa smurf <DSOldham@[  2008-05-13 19:43:28 
Re: Help!
"Dan Guzman" &l  2008-05-13 22:06:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 0:44:10 CST 2008.