Search Results

Search found 6 results on 1 pages for 'brokemylegbiking'.

Page 1/1 | 1 

  • One big call vs. multiple smaller TSQL calls

    - by BrokeMyLegBiking
    I have a ADO.NET/TSQL performance question. We have two options in our application: 1) One big database call with multiple result sets, then in code step through each result set and populate my objects. This results in one round trip to the database. 2) Multiple small database calls. There is much more code reuse with Option 2 which is an advantage of that option. But I would like to get some input on what the performance cost is. Are two small round trips twice as slow as one big round trip to the database, or is it just a small, say 10% performance loss? We are using C# 3.5 and Sql Server 2008 with stored procedures and ADO.NET.

    Read the article

  • Query to update rowNum

    - by BrokeMyLegBiking
    Can anyone help me write this query more efficiently? I have a table that captures TCP traffic, and I'd like to update a column called RowNumForFlow which is simly the sequential number of the IP packet in that flow. The code below works fine, but it is slow. declare @FlowID int declare @LastRowNumInFlow int declare @counter1 int set @counter1 = 0 while (@counter1 < 1) BEGIN set @counter1 = @counter1 + 1 -- 1) select top 1 @FlowID = t.FlowID from Traffic t where t.RowNumInFlow is null if (@FlowID is null) break -- 2) set @LastRowNumInFlow = null select top 1 @LastRowNumInFlow = RowNumInFlow from Traffic where FlowID=@FlowID and RowNumInFlow is not null order by ID desc if @LastRowNumInFlow is null set @LastRowNumInFlow = 1 else set @LastRowNumInFlow = @LastRowNumInFlow + 1 update Traffic set RowNumInFlow = @LastRowNumInFlow where ID = (select top 1 ID from Traffic where flowid = @FlowID and RowNumInFlow is null) END Example table values after query has run: ID FlowID RowNumInFlow 448923 44 1 448924 44 2 448988 44 3 448989 44 4 448990 44 5 448991 44 6 448992 44 7 448993 44 8 448995 44 9 448996 44 10 449065 44 11 449063 45 1 449170 45 2 449171 45 3 449172 45 4 449187 45 5

    Read the article

  • Copy values from one object to another.

    - by BrokeMyLegBiking
    Anyone have a suggestion for a good utility class that maps values from one object to another? I want a utility class that uses reflection and takes two objects and copies values from the 1st object to the second if there is a public property with the same name. I have two entities that are generated from a web service proxy, so I can't change the parent class or impliment an interface or anything like that. But I know that the two objects have the same public properties.

    Read the article

1