.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Run multiple MS SQL update queries

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :ASP.Net
On satisfying the If condition, I need to run 2 MS SQL update queries. How can I accomplish this? I am using C# as the server side language. Any help is appreciative.

View Complete Post

More Related Resource Links

>>>How to update multiple rows of gidview by one click



I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.

Multiple update statements per row in Gridview Edit


I want to set up a gridview that will display data like this

WeekEndingDate Project Category Sun Mon Tues Wed Thu Fri Sat
8/14/2010      proj1   test     2   1   2    3   2   1   0
8/21/2010      proj1   test     0   2   2    2   2   1   0
8/28/2010      proj1   test     0   1  

Running a single SQL update query on multiple foxpro databases

Hi, Env : SSIS 2008 My requirement is to run a update SQL statement on multiple foxpro databases. The fox database paths are available in a SQL server table.  I've created a for each loop control and assigned the database path to a variable named dbpath. Within the loop, I added an "execute sql task" control. Now what properties are to be set to get the requirement done. Appreciate any help. Regards. BH  Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH

Multiple Update panel

 Hi All, I just need a small confirmation, that using multiple update panel in single ASP Page is a good practice or not? a. I can put whole page in single Update panel b. I can have multiple update panel in single page.   please suggest me which approach is good. I dont want to refresh all controls on very callback/postback.   thanks siraj    

conditional update a column base on multiple result

Hi, I have a requirement that to conditional update a column base on the table result within a single update statement.     declare @TableStageStatus table ([OldTable] [varchar](100) NULL, [OldKey] [varchar](100) NULL, [StatusCode] [varchar](10) NULL) declare @Table table ([Key] [varchar](100) NULL, [row_stus_cd] [varchar](10) NULL) INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'1','I') INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'1','I') INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'1','E') INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'1','I') INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'2','E') INSERT INTO @TableStageStatus ([OldTable],[OldKey],[StatusCode]) VALUES ('a' ,'1','E') INSERT INTO @Table ([Key],[row_stus_cd]) VALUES ('1',null) INSERT INTO @Table ([Key],[row_stus_cd]) VALUES ('2',null) UPDATE A SET A.row_stus_cd = case when row_stus_cd is null then B.StatusCode when B.StatusCode='E' then 'E' else B.StatusCode end FROM @Table A INNER JOIN @TableStageStatus B ON A.[Key]=B.OldKey and B.OldTable='a' WHERE B.StatusCode in ('E','I') select * from @Tab

Update Statement help from Multiple database

Hi I am having two separate datbase on same sever one datasbase name private from where i am executing my below query and other name is ODS Table name in Private=[A].[DimCapabilitySpecialty] Table name in ODS = [A].[CapabilitySpecialty]   both of them having column SpecialtyCd   i want to update the flag value of ODS table where there is particular specialitycd missing in source means table in private database   so for that i wrote below query   update A.DimCapabilitySpecialty set ActiveInd ='I' where SpecialtyCd !=[ODS].[A].[CapabilitySpecialty].[SpecialtyCd]   But it is giving me this error   Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "ODS.CapabilitySpecialty.SpecialtyCd" could not be bound.

how to update multiple row in one update button click

hi all,   im having a gridview in which im displaying records and status.....this gridview shows employee applied leave waiting for approvals.. so in gridview i have chabged the status button as radio button list and giving two choices as approve/reject ....so HOD seect relevant button and update the grid... how to do this? 1) do i need to place a button on footer and do some write code behind? 2) or any other easier way?

Insert/Update data to multiple tables on a single button click


Hi experts,

I need to insert/update data to 3 or more tables on a single button click.What is best method for achieving this?I am using mysql as my DB.

Thanks for your valuable reply in advance.

Multiple sql server update statments in SSIS OLE DB Command


Is it possible to issue multiple sql server update statements in SSIS OLE DB Command?


I Tried the following with no luck


update table1 set column1 = 1


update table2 set column1 = 1

How to update multiple rows in gridview in one shot?

Hi I am using an SqlDataSource control to bind employee data to the gridview.I am displaying 20 rows per page and each row has a checkbox in the Itemtemplate. I may select(check) randomly 15 rows. I want to update all these selected rows in one shot. Is it possible in gridview? Would somebody explain with a piece of code..?

Update Multiple Row in same column with different text


Hi all!

I am trying to explain with example what i want to do. I have a table that has names and surnames of people. Some of names are null in table and i know its number. I want to update null values but i want to give to every row different names not updating with single name.

ali yilmaz
NULL mert
NULL pol

Can i update these two records with names of 'ahmet' and 'yasir' within one single update statement

I hope i could explain my question. Any help would be so appreciated.


Ahmet UZUN

reading Multiple queries in If condition


I have search input on my web page txtSearch.text(Column name is JobNO ,this column present in all the 3 tables), when i submit a value click on search button it has to read 3 tables.is it appropriate writing 3 queries in if condition..something like follows but not sure of it

if  txtSearch.text<>"" then
Query=select * from ship
elseif txtSearch.text<>"" then
Query=select * from openorder
Query=select * from schedule
end if

when i give above input it should read 3 tables and write the value on grid view,i am held up here and thankful to you can any one provide the possible solution

Update Trigger For Multiple Rows



I've written a trigger that fires on a table after an insert and SHOULD update the destination table if a record exists or performs an insert if the record doesn't exist. I'm having trouble because in some instances it won't run because the subquery is returning multiple rows from the INSERTED table. Code is below. Any help is greatly appreciated.


CREATE TRIGGER [dbo].[InsertOverflowHistory_Trigger]
  ON [dbo].[ContainerDetail]

  DECLARE @Store       NCHAR(5);
  DECLARE @ItemWeight    DECIMAL(12,4);
  DECLARE @ItemCube     D

Multiple queries in a detail view


Hey ASP Guru's,
I am working on a form that has a details link(Details.aspx?id={0}&id2{1}). 
Then on the Details.aspx, the 2 variables will be used in a 
Store Procedure to create detailview. My store procedue on the Detail view page is a basic If Else statement. If ID2 = 1 then run this statement else run this statement. 
This is the tricky part the If part runs a query on a different table then the Else Part. My 2 questions are: Can this be done? and Is there a better way?

Hey ASP Guru's,

I am working on a form that has a det

Parameter queries running multiple times


Currently running SQL 2005 sp2 SSRS.  We were in the process of tuning a report's queries against DB2 when our DBA noticed in the tracing log that the queries used for the parameter list is ran 2 times for each parameter.  They are cascading parameters with a Date only, but we tested removing the dependancy and the parameter query still ran 2 times.  We tested setting all the default values for initially opening the report and after we just opened the report and it rendered, nothing else was touched, the parameter queries all ran 2 times.  Any idea of why this happens.  I tried to search for this and couldn't find anything.


Need suggestion on complex UPDATE and INSERT queries


Hello Gurus,

I need a suggestion from you masters on performance and the best method for the kind of queries I have written.

I have pretty big UPDATE and INSERT queries like











AJAX Update Panel Queries....


Hiii Everyone...

I Want to build a page in which there are two text boxes and a drop down list....

Depending on the value of textbox and drop down list i am trying to get values from database....which checks for several roll number...

I want to count few roll numbers say 20 (in my form it depends on the values of text box and drop down list )whose status is loggen in that is i have set it in my database as (1) and the update panel should continously check whether all the 20 roll numbers have logged in or not....and if it gets the count correct a button is placed in the form named...BtnStart which should be enabled...i have tried a lot..gone through many websites for update panel but was unable to sort out the problem....can anyone give me a good suggestion to create this form...or can anyone tell me how to do this ....

And inside the update panel i want to get all the roll numbers whose status is logged in either in grid view or any other good control...

i am developing the application in vb.net so plz try to post the vb code...or else c# code...

Hope will get a good suggestions...


Have a nice day friends :)

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend