.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

store update sum

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Okay, so i created the following query select a.cusip, SUM([UnitsHeld]) AS unitsSum From [GTC_PA_SQL2].[DW].[dbo].[HoldingsC] h inner join [GTC_PA_SQL2].[DW].[dbo].[AssetsC] A ON h.securityID = a.securityID Where cusip IS NOT Null AND MinSecClass In (9,10,58,59,60,64,65,69,70,79,80,85,87,215,216,220,229) group by a.cusip However, now i need i need to change this so that instead of a on the fly query, the values are stored and the query will run only once a quarter or so.  This is what i have so far: update dbo.finance set PAR= (select SUM([UnitsHeld]) AS unitsSum From [GTC_PA_SQL2].[DW].[dbo].[HoldingsC] h inner join [GTC_PA_SQL2].[DW].[dbo].[AssetsC] A ON h.securityID = a.securityID Where cusip IS NOT Null AND MinSecClass In (9,10,58,59,60,64,65,69,70,79,80,85,87,215,216,220,229) group by a.cusip) The table i need to store the UnitsSum value in the dbo.finance table under the field PAR which correlates with a PK of cusip, this table doesnt have any securityID reference. The issue with need these queries stems from the fact that i need a total UnitsHeld for each security class which has a cusip9 attached to it. However the database right now stored the unitsheld for each portfolio and not as a total for reach cusip which i need.

View Complete Post

More Related Resource Links

SQL Server CE: New Version Lets You Store and Update Data on Handheld Devices


Handheld device users need to be able to synchronize with a main data store when it's convenient and, preferably, when the back-end database server isn't busy. SQL Server 2000 Windows CE Edition allows you to build a traveling data store that can be displayed and run on a variety of devices. SQL Server CE supports a subset of the full SQL Server package, and can be used as a standalone server or in tandem with SWL Server and IIS. The architecture of SQL Server CE, along with data manipulation, synchronization, and connectivity issues, are discussed in this article. Topics such as making your data public, choosing the right type of replication, and handling errors are also covered.

Paul Yao and David Durant

MSDN Magazine June 2001

ListView update using Store Procedures.

Hi,I have a list view where I use SqlDataSource with Store Procedures for teh Select and Command:<asp:SqlDataSource ID="SqlDS_BasketDetails" runat="server"  ConnectionString="<%$ ConnectionStrings:EcoDBConnectionString %>" SelectCommand="get_BSKT_details_SP" SelectCommandType="StoredProcedure" UpdateCommand="in_mod_del_BSPR_SP" UpdateCommandType="StoredProcedure" > <SelectParameters> <asp:Parameter Name="UserID" Type="Object" /> <asp:Parameter Name="ID_BSKT" Type="Int32" /> <asp:Parameter Name="myLang" Type="String" /> </SelectParameters> <UpdateParameters>     <asp:Parameter Name="ID_TNDA" Type="Int32" />     <asp:Parameter Name="ID_BSKT" Type="Int32" />     <asp:Parameter Name="ID_PRDT" Type="Int32" />     <asp:Parameter Name="cantidad" Type="Int32" />     <asp:Parameter Name="UserID" Type="Object" /> </UpdateParameters> </asp:SqlDataSource><asp:SqlDataSource ID="Sql_Basket" runat="server" ConnectionString="<%$ ConnectionStrings:M

Deadlock: Store Procedure that only contains select statement owns an update key lock


I have a seemingly simple deadlock graph that contains 2 SP's. One SP is updating a table, while another SP (the victim) is selecting from it. The interesting thing about the graph is that the SP that contains the select (and only a select) is shown to own an UPDATE lock on the table that SP2 wants to update. How is this possible?



Auto-Update Managed Metadata Term Store from External DB or List

Hi all,

I have been able to import terms using the .CSV file within the MMSA Term Store, but is there a way to auto-update the terms from an external list. Example: An external database already has terms and adds terms on a regular basis. Is there a method for updating the Term Store automatically when terms are added in the external source. Perhaps creating a SharePoint List populated with external data and somehow linking this up to the Managed Metadata terms? I know that System keywords are added to the term store when a user tags an item, but is there a way to tie into this functionality for managed metadata?

How to update data and store a value based on a comparison



i want to implement a stored procedure that updates values from a field named MYVALUE with


but if the result MYVALUE is greater than 100 (MYVALUE > 100) then set MYVALUE equal to 100.

I can't figure a way to do this. I am trying to implement it into a stored procedure so that i schedule it to run every dat.

Thanks in advance

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

Store and Display Images from MS Access Database Using C#

There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0

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.



How to store more than 4k bytes of data in SQL CE 4?


I need to store more than 4k of bytes in my SQLCE 4 database. How can I do that with the ASP.NET Web Pages 1.0?

1: The Microsoft.Data provider fails when I try to populate a parameter with more than 4k bytes.
2: Referencing SqlServerCe assembly and using SqlCeConnection/SqlCeCommand/SqlCeParameter throws exception:  SQL Server Compact is not intended for ASP.NET development.

How can I somehow map the generic DbType, which does not have NText as an option, to the ntext column in my database? (SqlCeParameter supports DbSqlType, which has ntext, but see problem #2)

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?


Store and display Japanese characters



Can anyone tell me the best way of storing Japanese characters through ASP.NET.
I have to put characters into a asp:textbox on one page, which saves it to an Access DB.
On a second page I want to display the content in a asp:label.

Should I store the characters directly to the database or should they be encoded, and
how do I encode the characters? 

In my web.config i have:

<globalization fileEncoding="ISO-2022-JP" requestEncoding="ISO-2022-JP" responseEncoding="ISO-2022-JP" culture="ja-JP" uiCulture="ja-JP" />  

On the display page I have:

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=shift_jis">


Internet Explorer 8: New Features To Slice, Store, And Accelerate Your Web Applications


Internet Explorer 8 sports some exciting new features including Web Slices, Accelerators, and search suggestions along with AJAX navigation and DOM storage.

Daron Yöndem

MSDN Magazine March 2009

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