.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

How to bulk update?

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :Sql Server

hi friends,

i have declared thsi tabel:

	declare @tbl_ans table ( a_idx int, AnsText nvarchar(max), is_correct bit, is_active int)

a_idx is not an indentity column

the table has data

then i have declared thsi:

			declare @val table (idx int, a_text nvarchar(max))

idx is not an identity column, te tbale @val is store the id values and a_text1 values of Answers table after inserting values to teh answers table

There is teh third table Answers of the following structure:

a_idx int, // this i an indentity column 

a_text1 nvarchar(100), 

upt_date datetime, 

rversion timestamp

In my Previouose thread i have written the insert statement for this

View Complete Post

More Related Resource Links

doing bulk update

Hello Everyone, I have a gridview. users can update the database using this gridview. There are about 10 columns and 60 rows in this gridview and once the user makes the changes to a particular row, there is an update button on that row and user can click that button to update the changes that he/she made. My boss wants to remove the update button from each row and put the button at the bottom of the gridview. he says that I will make the changes to whatever rows, I want to make the changes to and then hit the update button that is at the bottom of the grid and it should make the changes to all the rows in the database. I can accomplish this by opening the database coonetion and making a call to the database several times and updating row one by one or I can do all bulk insert. how can I acheive this bulk insert because the other option is quite expensive. Please let me know if anyone has any ideas. Thanks in advance  

Active Directory bulk data update error System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIf



we are trying to update bulk data into Active Directory from some database table. If we run for say 40000 users, it fails in between While updating its failing with an exception that. The server is not operational.

at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_AdsObject()
   at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
   at System.DirectoryServices.DirectorySearcher.FindOne()

Below is the piece of code updating the records ...


While drDataReader.Read()
                strMailID = drDataReader.Item(("EMAILID")).ToString()
                strAttributeName = drDataReader.Item("ATTRIBUTENAME").ToString().Trim()
                strAttributeValue = drDataReader.Item("ATTRIBUTEVALUE").ToString().Trim()

Bulk update of columns using xquery and xml parameter


 I have an application that updates more than 150 columns in the database. I was looking for an alternative to using
 an SP with a huge parameter array (which would be quite stupid) and decided to use a method that i found on MSDN, that is ,
 passing the data in an xml document like this :
 If it comes to inserting data into a table , this is very helpful, i can do something like this :
 DECLARE @result TABLE (xml_data XML )
 DECLARE @resultTable TABLE ( CODE varchar(20) , TOPC_XML XML )
 INSERT @resultTable
 SELECT   x.y.value('local-name(.)', 'VARCHAR(30)' ), 
 FROM @result 
 CROSS APPLY xml_data.nodes('/DATA/*') x (y)
But the problem is that along with insertion , I also have to update columns in the destination table. Is there some way that i can sort of iterate through the xml and create a update statement ? Or am i going down the wrong path? This method also poses the problem of data types. How can i preserve the data types ? One way is to send them along in the xml like this :


here is trigger if exist then update else inser but not working properly for bulk update(10 or 15 ro



i have a trigger as follows



TRIGGER [ table_detail_insert_update]








Bulk insert / update Xml ????


Bulk Insert

I want to get the count of XMLProdTable.ID =  TBL_TEST_TEST.ID In a select query . How do I frame a select query for this

If the count equals zero I'll allow insert if greater I'll skip insert query.

Please help me on this

CREATE PROCEDURE [dbo].[spTEST_InsertXMLTEST_TEST](@UpdatedProdData nText)
 DECLARE @hDoc int  
 exec sp_xml_preparedocument @hDoc OUTPUT,@UpdatedProdData

       WITH (
                ID Int,                
                NAME varchar(100)
            ) XMLProdTable

EXEC sp_xml_removedocument @hDoc

Regards, Gullu.

Bulk update on a list for all versions



I have a list with items with the list items having multiple versions

I want to do a bulk update on my list which will add a column with a default value. I can do it using code but I want this to happen for all the versions of the list items. Currently it is happening only for the latest version of the list items. Has someone done it or is it even feasible ?


Thanks !


ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Update Vs SystemUpdate

Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().

What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

>>>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.

Visual Studio closes itself by opening aspx-Page designer after Windows Update


Hey Guys,

I've a problem with my Visual Studio.

On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.



Update net frame 3.5.


I use visual studio 2008 but It's only use net frame work 2.0, Can I update and use net frame work 3.5 for Visual Studio 2008 ? Please help me !


update/delete not working on server only


my aspx page works in VWD, and everything works on the server EXCEPT update and delete sql functions. any ideas?


Bulk Copy From Datatable To SQL Server Table


 I have read the data of a excle file and captured the data into the dataset to a datatable, now that data is to be inserted into a SQL Server table using bulk copy option. I am using -

 public bool BulkEnterData(DataTable dt, string tblName)
        SqlBulkCopy bulk = new SqlBulkCopy(con);
        bulk.DestinationTableName = tblName;

        return true;

ERROR Getting-
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.) 

How to resolve the above problem or any other solution is available.


How to send bulk sms from asp.net


Hi experts,

I want to send and receive sms in my asp.net website.I am currently targetting users in India.I may need to send the same sms to thousands of users at the same time.How can I achieve this?

Thanks in advance

C++ at Work: Persisting View State Update, Using Managed Extensions in a DLL


This month marks the 11th anniversary of my column and the inauguration of a new title: C++ At Work. We're also adding a new bimonthly column, "Pure C++," by my pal Stan Lippman, one of the great C++ Masters.

Paul DiLascia

MSDN Magazine February 2005

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