Updating multiple tables in sql server Live free adult webcam lexington ky

The same java code works for me when I use it with out sp's. USE [Test1] GO /****** Object: Stored Procedure [dbo].[Update2Tables] Script Date: 11/18/2008 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE Update2Tables @Action varchar(50), @Doc int OUTPUT, @Dte datetime, @File Name varchar(50), @Disp Name varchar(50), @Image image, @Plan int, @State varchar(50) AS IF @Action='Update' DECLARE @update_error int BEGIN TRY BEGIN TRANSACTION UPDATE BENEFIT_PDF SET [email protected], [email protected] Name, PDF_DI [email protected] Name, [email protected] WHERE [email protected] UPDATE PLAN_PDF SET [email protected], [email protected] WHERE [email protected] SELECT @[email protected]@ERROR IF @update_error=0 BEGIN COMMIT TRANSACTION END END TRY BEGIN CATCH IF @update_error0 BEGIN ROLLBACK TRANSACTION END END CATCH IF @Action='Insert' DECLARE @insert_error int BEGIN TRY BEGIN TRANSACTION INSERT INTO BENEFIT_PDF VALUES(@Dte,@File Name,@Disp Name,@Image) SELECT @Doc=SCOPE_IDENTITY() INSERT INTO PLAN_PDF VALUES(@Plan,@State) SELECT [email protected] SELECT @[email protected]@ERROR IF @insert_error=0 BEGIN COMMIT TRANSACTION END END TRY BEGIN CATCH IF @insert_error0 BEGIN ROLLBACK TRANSACTION END END CATCH IF @Action='Select' BEGIN SELECT PDF_IMAGE FROM BENEFIT_PDF WHERE [email protected] END I can use a single try catch to handle the errors but here I just use the seperate try catches to be more clear but I will change it later. If the result is the same as when run from the front end then the problem is in the stored proc.

Please help me in this how could I achieve that same benefit details for different states. In that case copy one of the insert statements and paste it into query analyser.

statement can be accomplished in one of two ways, primarily depending upon which version of SQL Server you are using.

We’ll briefly explore both options so you can find what works best for you.

Whenever you have problems getting a large task to work, always break the problem down into smaller pieces and get that small piece working.

Then you can put the working pieces back together into the larger task, knowing that that smaller piece is working. Now to the problem of inserting extra records into the PLAN_PDF table.

Not overly difficult but ck's suggestion is the better option by far. Here I am retrieving the pdf file based on identity column.

It is difficult to give you working queries for your particular question without having access to everything that you have access to. Yes I have to get the identity column from my application, from the stored proc and have to return that number to some other method. As for other error handling, you need to think of what could go wrong and try and cover it. Hi Delerna, I can upload the pdf file directly from the java application with out using the stored procedure.(using prepared statement in java) But the problem here is I can not get the identity column value to my application which I need to return it to another application.

Please send me the code for the joining these tables(with specified condition) in the stored procedure so that I can write front end application.Hi Delerna, If I do not use the stored procedure, I need to update these tables through my application right? We are just creating a helper class in java(which make use of these sp's in the database and call them) and giving it to the other vendor who can actually make use of that code.If so I need to join these 2 tables and do the insert/update from my application. Like I mentioned more than one state can have the same benefit details. In the future if the client want to implement this service class with another .As I said before more than one state can have the same benefit details.and client should able to populate these tables with same benefit details but different states.

Leave a Reply