.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


Posted By:      Posted Date: October 12, 2010    Points: 0   Category :Sql Server

I have just discovered the INNER LOOP JOIN. I have no idea when to use this feature instead of the regular INNER JOIN. Are there any rules to its use?

If I incorrectly use the INNER LOOP JOIN can it cause me to bring back incorrect data? I am worried about presenting wrong data/ row counts etc.


Mr Shaw

View Complete Post

More Related Resource Links

Microsoft's Collaborative Application Markup Language (CAML) Loop

discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is:

for each loop



Need help in for each loop. i'm poor in for each loop. i wanna create a for each loop that can give me 2 value in each rows.

i create a for loop.. but is a mulitple rows. Anyone can help ?

here is my code.

Dim x As Integer, y As Double, x1 As Integer

        Dim d As Date, prevD As Date
        Dim d1 As TimeSpan

        temp_sec = ac.getTempTime(ddl_date.SelectedValue, ddl_id.SelectedValue)

        For I As Int32 = 0 To temp_sec.Tables(0).Rows.Count - 1
            If I Mod 1 = 0 Then
                ' To prevent list out of bounds
                If I + 1 < temp_sec.Tables(0).Rows.Count Then
                    d = temp_sec.Tables(0).Rows(I).Item(0)
                    prevD = temp_sec.Tables(0).Rows(I + 1).Item(0)
                    d1 = prevD - d
                    x = d1.TotalSeconds
                    x = x1 + x
                    y = temp_sec.Tables(0).Rows(I).Item(1)
                    list.Add(x, y)
                    x1 = x
                End If
            End If

Join Two Tables and Prepare Report



            I have a select query which is executing well. Now, I want to add one more field to that query. That field is not in the current query table, It is in the another table.

How do I join those two tables and get that field value in the existing select query.?


Linq join fields for return data


  how would I join fields together?

           return (from c in storedb.Product_Categories

                         where c.Category_Name.Contains(searchText)
                         orderby c.Category_Name
                         select new {
                                    c.Category_Key && " ;" && c.Category_Name // HOW CAN I DO THIS.....

How to join two sharepoint list in c# by CAML query?

Hii All,
   I am using wss 3.0 and i have one site and site has 4 to 5 lists. lists are interconnected with lookup column and same column. I need to display some column fron one list and some from another.. i need to join that lists by where condition like project =project..

So how can i join??

Thank You

Cannot properly join lists in SPD 2007


Ok, I have been reading all sorts of posts and such for about a week and still have no come up with any concrete answers.


I cannot properly join lists in SP 07. I say properly because I never get the option to select a field to associate one with the other. 

I select "Create new linked data source" from Data Source Library; Pane opens; Left Click "Configure Linked Data Source"; Add 4 to 5 lists from "Current Site"; Select Next; Select Join option but Next is greyed out. Is this supposed to be greyed out because they are lists? Can lists be joined? I see alot of examples on joining databases and excel pages but not too many on lists.

If I select next from the last point, open the linked sources and select my newly created linked source and click to show data, I can see all of the information in there. Problem is I don't believe the lists are really joined by anything since I never received an option for it. 

I also have been reading up on joined subviews but I never receive an option for  joined subview. Is the joined subview the way to go for lists? If so how?


I know these boards are fairly active and any information or help would be greatly appreciated.

Loop for every record


Hi guys.

I've got a simple table with an ID, a NAME and an ARCHIVE booleen.

I want to write piece of code that goes through each record and...

If ARCHIVE is false and a folder hasn't been created for it, it will create it and go to the next record.

If ARCHIVE is false and a folder has been created for it, it will do nothing and go to the next record.

If ARCHIVE is true the whole folder will be moved to another folder and go to the next record.

When all records have been checked, the code will end.

I was thinking of using a SQL count to find out how many records there were and making a loop that starts at record one. runs the folder checking/creating/archiving code then +1 until the loop ends but I couldn't work out how to assign the query results to an integer...

I'm not asking for anyone to write the code. I think I probably already know 80% of the theory behind doing this I just can't glue it all together. I know you can do the folder stuff with the System.IO Directory Class...

Anyway, all input is welcome. Cheers guys!


insert into in combination with inner join


Hi All,

I have my data split in 3 tables for cascading dropdownlists.

How can I make an update statement of this select statement?

SELECT distinct BIER.Naam as naam1, BIER_L2.L2_Naam as naam2, BIER_L3.L3_Naam as naam3
	from BIER, BIER_L2, BIER_L3
	where BIER_L2.L2_ID = BIER.L2_ID and BIER_L2.L3_ID = BIER_L3.L3_ID 



Loop with DataReader


Hi.  I am having a really hard time with this code trying to loop through a datareader, and then enter the data into another table.  The logic is that I get 2 columns path and document_no from an Oracle Database.  I then need to check if the file in the path column is a valid path.  If it is not valid, it should be inserted into a SQL Server 2005 database.  My code is below, can anyone help?  I'm getting a headache from it.  If any further info is needed just let me know.  Thanks. 

Do While oraReader.Read()
                path1 = oraReader("Path")
                docno = oraReader("Document_No")
                If (System.IO.File.Exists(path1)) Then                    
                    sqlCmd = New SqlCommand("INSERT INTO CHECKLINKS1 (DOCUMENT_NO) VALUES (@doc)", conn)
                    sqlCmd.Parameters.AddWithValue("@doc", docno)
                End If


how to get current loop order number in "for each" ?

For Each item As pages.tbl1Row In pagesdim x as integerx = ?????response.write("current loop is :" & x )               Nextwhat code i need to replace with "?????" to get current loop order?

Join 2 flat file data flows - retain unmatched rows

I have two data flows from two separate flat files. They may contain matching IDs (account number), in this case specific data from each flow should be used to create one row. When there is no match, the rows would stand on their own. At the end of the flow, I need both flows combined into one flow, with one record for each key record (account number). If I were able to use a look-up, I could easily union the no-match data flow back into the match data flow and have the desired result. I cannot use a look-up, since the source is flat files, but this is exactly the functionality I am trying to achieve. Solutions I want to avoid: staging tables, and cache transformations. Any ideas are appreciated.

repeating merge joins using full outer join - should be possible without sort, but cannot get the co

Hello,   I am trying to combine several source tables with Merge Join.  For the Moment I have three source tables all already sorted in the source query and the is sorted property with the correct keys set. (its an aggregate query with group by and sort by the key columns) Then I do a merge join between two of the tables - with a full outer join. Then I just want to do another merge join with the output of the next result. but as the merge join do not combine the key columns into one column I need to add a derived column which substitute null values on the left side of the join with values from the right side of the join. The second merge then says only the left columns of the first merge join is sorted, but not the comined columns. If i Replace with a derived column the left side primary key columsn with the combinded key columns the next merge join says the input is not sorrted? But the output must be sorted. So how do I get the next merge join working without the ssis sort transformation? the data is sorted, but the component does not recognize the sorted data? I do not want to use (can use) the sort because there are flowing >= 500 Mio. records through the pipeline. Any help appreciated.   Hanneshttp://www.hmayer.net/

select max record to join another table sybase

select a.pono,(select (user) from user where userid=a.userid having date=max(date)) as user from a inner join b on a.no=b.no  in the result , i have selected the same id and retrieve two records every thing are same except the date how can i select the record out of two record which date is max date as the where Clasuse to select correct user poid    date                name 1        12/08/2010      Mary 1        20/08/2010      Peter   now i would like to select name which id=1 and date is max and then use the name to join another table because name is foreign key  

problem with inner join

Hi, I'm trying to create an sql query with multiple inner joins, but I can't manage this. I have 3 tables (bookings, accountplan, costs), where the data come from. In accountplan are hold the accounts, in costs the cost codes and their names, in bookings the booked events. Based on a booking event, I need the account name, the name of the cost code and all data from bookings (I need the cred account name too, but I can't figure out yet, how I can get this) I tried this: "SELECT bookings.*, accountplan.accountname, costs.costname FROM bookings INNER JOIN accountplan ON bookings.debaccount=accountplan.account INNER JOIN costs ON bookings.costcode=costs.costcode" It is here a where clause too, but I tested it, it's ok. The above query results no rows. If I remove the costs table and the inner join with it, it works. What am I missing?


I'm currently experiencing a spinloop wait type with command of Unknown Token. The issue occured when I copied DB filed from another server and attempted to attach it -using the SSMS wizard - to the affected DB. The attach failed due to an OS permission error but the database engine - for no clear reason - mounted the DB in a Recovery/Read Only mode; the transaction did not rollback. This rogue DB cannot be altered, dropped, detached, etc and KILL command fails against the culprit SPID. In the DB log there is a stack dump at Location:  "logmgr.cpp":5527, * Expression:  !(minLSN.m_fSeqNo < lfcb->lfcb_fSeqNo). And the errors: Error: 17066, Severity: 16, State: 1; Error: 3624, Severity: 20, State: 1. The logs continue thereafter with the following: Process 29:0:0 (0xe48) Worker 0x0000000015D6E1C0 appears to be non-yielding on Scheduler 18. Thread creation time: 12927361417467. Approx Thread CPU Used: kernel 46 ms, user 4040 ms. Process Utilization 7%. System Idle 88%. Interval: 132567 ms. I also discovered that sql server agent will not run jobs although the serive is running. Its logs read: 2010-08-27 08:36:26 - ? [393] Waiting for SQL Server to recover databases... 2010-08-27 10:41:59 - ? [131] SQLSERVERAGENT service stopping due to a stop request from a user, process, or the OS... 2010-08-27 10:42:00 - ? [098] SQLServerAgent term

Need help on populating data on a datagrid using SQL Join

I have a table called Leaves. Fields are,LeaveIDPersonIDActingPersonIDIn Person's table, I have,PersonalIDEmployeeCodePersonNameNow, in the datagrid, I need to show,PersonEmployeeCodePersonNameActingPersonEmployeeCodeActingPersonNameNow, I know how to write the SQL Join to get the data populated. But, the problem is, in some cases, there won't be any acting person. In which case, I need to display data, PersonEmployeeCode = 0001 PersonName = John ActingPersonEmployeeCode = - ActingPersonName = No acting Person Now, I am stuck here. How do I do a conditional join statement?Please help! RegardsKush

Serialization error in a for each loop

I have a for each loop in a 3.5 workflow. This takes a list if criteria to build a query string to call a Secure Webservive necesitating the use of a certificate. I load the certificate further up stream and pass it as a dependency property. The process returns a serialization error for the certificate. How do I avoid this error?  Thanks!
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