View Single Post
  #3 (permalink)  
Old November 12th, 2011, 08:12 PM
NovicePGM2011 NovicePGM2011 is offline
Authorized User
Points: 53, Level: 1
Points: 53, Level: 1 Points: 53, Level: 1 Points: 53, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts

Originally Posted by Paul_Turley View Post
You're absolutely right. I beleive that when the stored procedure script was pasted into the manuscript, the last line was omitted. My appologies. The code should read:

@ContactID int
, @FirstName nvarchar(50)
, @LastName nvarchar(50)
, @Phone nvarchar(25)
UPDATE MyContacts
SET FirstName = @FirstName
, LastName = @LastName
, Phone = @Phone
WHERE ContactID = @ContactID

Regarding your second question, any column or combination of columns can be used in a WHERE clause to qualify records. Just keep in mind that only the primary key is used to guarantee uniqueness.
Thanks Paul!! I was about to give up!
This is all new to me.

So lets say using the above code, but instead of specifying the update by Id as you just mentioned, I wanted to use the same stored procedure but performed the update by using the stored procedure with a where clause.

Example: Update record is First name = paul and last name = Turley.

I know in the real world this would be the wrong way but I for the sake of learning.

Thanks again!
Reply With Quote