.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

Whats the reason for this infinite loop?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Sql Server
hi friends, i have the following fucntion that tokenize a CSV string and return a table of values create function fn_get_int_table_frm_csv ( @csv_values nvarchar(max) ) returns @indexes table (idx int identity(1, 1) primary key, Role_id int) as begin declare @ret nvarchar(max) declare @comma_pos int declare @token nvarchar(max) set @ret = @csv_values while len(@ret) > 0 begin if( len(@ret) <> 1 ) begin -- gets the first occurance of the "comma" in the @ret set @comma_pos = charindex(',', @ret); -- gets the first values that was seperated in the string set @token = substring( @ret, 1, @comma_pos - 1 ) -- add that to the return table insert into @indexes values ( convert(int, @token) ) -- set a new starting position set @comma_pos = @comma_pos + 1 -- Tokenize the string from the new starting position set @ret = substring( @ret, @comma_pos, len(@ret) - (@comma_pos - 1) ) end else begin set @token = @ret -- add that to the return table insert into @indexes values ( convert(int, @token) ) end end return end go when i execute this by passing '1,2,3,4' the argument, it goes to an infinite loop, how do i fix it? thanks

View Complete Post

More Related Resource Links

Infinite loop detected. The loop dependency is 3 -> 3.



I've run into the problem described in the title. I've created a dummy Benchmark dimensionw with a couple of members using a named query (Me, Competitors). In my calculation script I've got the following MDX:

[Benchmark].[Benchmark].&[Me] = [Company].[Organisation].CurrentMember;
[Benchmark].[Benchmark].&[Competitors] = 

The reason for this being that I would like [Company].[Organisation] as a background selection and I'd like the Benchmark members as the series.

Now when I run the following MDX statement

HIERARCHIZE( { DESCENDANTS( [Date].[Year - Quarter - Month - Day].[Year].&[2009], [Date].[Year - Quarter - Month - Day].[Month] ) } )
HIERARCHIZE( { [Benchmark].[Benchmark].&[Competitors], [Benchmark].[Benchmark].&[Me] } )
FROM [Cube]
WHERE ( [Company].[Organisation].[Key].&[036], [Measures].[My Measure] )

I would expect it to return the average number for the competitors and the number for me - but this is not the case. I get the correct value for [Me] but i get an infinite loop error for the competitors and t

Error message "Infinite recursion detected. The loop of dependencies is: ." but I have no recursion?



I have a query like

   MEMBER [Product].[AttribE].[grp6] AS
      Aggregate( { [Product].[AttribE].&[a], [Product].[AttribE].&[b], [Product].[AttribE].&[c], [Product].[AttribE].&[d], [Product].[AttribE].&[e] } )
      ,Caption = 'Some text'
   MEMBER [Product].[AttribE].[grp0] AS
      Aggregate(( [Product].[AttribE].[AttribE].Members - { [Product].[AttribE].&[a], [Product].[AttribE].&[b], [Product].[AttribE].&[c], [Product].[AttribE].&[d], [Product].[AttribE].&[e] } ))
      ,Caption = 'All Others'
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[200903], [Statistic].[Statistic].&[none]),
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[200906], [Statistic].[Statistic].&[none]),
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[200909], [Statistic].[Statistic].&[none]),
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[200912], [Statistic].[Statistic].&[none]),
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[201003], [Statistic].[Statistic].&[none]),
    ([Measures].[m], [Period].[Year-Six-Qtr].[Qtr].&[201006], [Statistic].[Statistic].&[none])
    ({ ([Product].[AttribA].&[A], [Product].[AttribB].&[B1], [Product].[AttribC].&[C], [Product].[AttribD].&[D1]) } * ( { [Product]

Approval workflow with moderation enabled goes to infinite loop


We are using WSS 3.0 and custom approval workflow from the SDK. The workflow is configured on a document library with the Moderation enabled. The workflow is set to trigger on item edit and new item creation.

The workflow works fine, sometimes goes into infinite loop. I know this was a known issue/bug with approval workflow and there was a patch released for this - KB 955586

We have WSS 3.0 SP 2 and i assume the above patch is included in the SP 2.

We are still facing the issue, should i explicitly install the above patch? What is the workaround for this issue?

Any help is highly appreciated.



Merge Replication Infinite Loop & Time Problem


Hi all,

We have merge replication system between Sql Server 2008 R2 64bit Enterprise Edition (As a Publisher&Distributor) and Sql Server 2008 R2 Express Edition (As 800+ Subscribers). We use only "https " method as transfer method. We have 30 tables and we have Joins & Filters. Our system work normally for 5-6 months.

But for last 10 days, sometimes (generally initial snapshot being downloaded), it takes over 14 hours to replicate!! I think an infinite loop is being occured during the process. I trace the publication server with Sql Server Profiler 2008 and here is the trace file.

Lots of times, i see this line "exec sp_MSmergeupdatelastsyncinfo '8C01EA1F-153D-47BC-ACD3-F8439ACB7B76',2,N'Merge completed with no data changes processed .'" (and also other lines which repeat similar to this one) with same/different  Session ID's. And when i first see this line is after 3 seconds the start time of the Process!! And after , 6 seconds again same line, and after 13 seconds again same line and it goes on like this. I think, in fact synchronization process is finished after 5-6 seconds (normally because there is no any data change in fact!) but for some reason, it continues to same process over and over.

Is this a bug or anything else, h

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:

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

Is there any way to find out the reason for session expiry?


Dear All,

is there any way to find out the reason for session expiry?



Whats wrong with this statement


Im trying to updated some old ASP pages with some new .net pages and cant seem to get this update statement to work. I need to update the current ASP code below and then once thats working im going to use that same statement in a procedure for all our new .Net pages..

So can anyone see what im doing wrong by inserting the 2nd column to the update statement?

strSqual = "update tas set date_completed='" & TransDate & ", trans_id=" & InsertedTransID & "' where date_completed is null and sercontract_id="& strContractID & " and DATEDIFF(dd,task_due_date,'" & strProcDate & "')<=14"


I am trying to add an extra column to the update, but not sure if the syntax is correct.

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

Whats wrong with this code, im getting blue line under the createStatus next the switch

Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

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!


System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

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?


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

Error starting SQL Server Agent - Could not load the DLL xpstar90.dll. Reason: 126

AD Service account password was changed.  Now the SQL Server Agent (MSSQLSERVER) will not start even after updating the password.  Have no access into the databases.  Log files say "Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.)."  Service Account has Full rights on system.  Any help in solving the problem would be great.

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