Stored Procedure
-
Hi, I have some problems with the updating of database. I will need to update 2 tables in one sql query and I am not too sure how to write a stored procedure with sql server. Need some guidance. Thanks. Regards, Jo
-
Hi, I have some problems with the updating of database. I will need to update 2 tables in one sql query and I am not too sure how to write a stored procedure with sql server. Need some guidance. Thanks. Regards, Jo
Where are you stuck ? What does the proc look like ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Where are you stuck ? What does the proc look like ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[UpdatePAppParty] @PID VARCHAR(10), @AID VARCHAR(10), @name VARCHAR(50), @designation VARCHAR(20), @status VARCHAR(15), @reasons VARCHAR(100) AS Begin Update [aParty eStatus] Set names = @name, designation = @designation, status = @status, reason = @reasons where aParty.APID = estatus.APID and aParty.projectID = estatus.projectID END this is the procedure that i came out with. not too sure if it is correct. Regards, Jo
-
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[UpdatePAppParty] @PID VARCHAR(10), @AID VARCHAR(10), @name VARCHAR(50), @designation VARCHAR(20), @status VARCHAR(15), @reasons VARCHAR(100) AS Begin Update [aParty eStatus] Set names = @name, designation = @designation, status = @status, reason = @reasons where aParty.APID = estatus.APID and aParty.projectID = estatus.projectID END this is the procedure that i came out with. not too sure if it is correct. Regards, Jo
That's one update statement, so just add your second statement and you're done, right ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
That's one update statement, so just add your second statement and you're done, right ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
i dont get what you mean by the second statment. The statement i have is to update 2 tables.
-
i dont get what you mean by the second statment. The statement i have is to update 2 tables.
Have the second update statement for the next table with the appropriate condition. Encapsulate the Update statements in a TRANSACTION block so that if an error occurs in one update, the data integrity is preserved.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
Regional Weblog (in Tamil) :: Voicing for the Society
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.