Re: max sp, func, trig, or view nesting level...
From: Steve Kass (skass_at_drew.edu)
Date: 07/02/04
- Next message: Steve Kass: "Re: max sp, func, trig, or view nesting level..."
- Previous message: Mischa Sandberg: "Re: Search Multiple Columns with REGEXP"
- In reply to: Alex: "Re: max sp, func, trig, or view nesting level..."
- Next in thread: Alex: "Re: max sp, func, trig, or view nesting level..."
- Reply: Alex: "Re: max sp, func, trig, or view nesting level..."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 01 Jul 2004 23:46:29 -0400
Beats me. While it doesn't explain the error, I don't quite see what
you're doing here - it may make sense, but inserting into a table a
cursor is based on in the middle of cursoring through is slippery
business. I don't know if the order in which the cursor rows are
visited is defined (thought it might not matter here). If donor (the
cursor) is empty, you insert into donor (the table), which then makes
donor (the cursor) not empty, and you hope to then insert from what just
went into the cursor into donorDonations... Is there really no way to
do this with simple insert queries?
The only think I can imagine is causing the trouble is if you have
something that can cause recursion - an indexed view somewhere?
I don't think Excel is involved, so can you possibly pare this down to
some sample data on which you get the error? I tried and failed to
cause an error.
SK
Alex wrote:
>No triggers - anywhere...
>
>
>"Steve Kass" wrote:
>
>
>
>>Did you look for triggers?
>>
>>SK
>>
>>Alex wrote:
>>
>>
>>
>>>None. That's the strange part....
>>>Does the Proc code seem good to you?
>>>
>>>All I'm doing is checking if record exists in the Donor table that matches that of sys_load. If it does, create a new record in DonorDonations, if it doesn't create a new record in the Donor table....
>>>
>>>I'm stumped. Thanks for your help, Steve.
>>>
>>>
>>>"Steve Kass" wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Alex,
>>>>
>>>> Is there a trigger on dbo.Donor, dbo.DonorDonation, or dbo.sys_load?
>>>>I suspect the problem is not with the code you've posted here, since it
>>>>doesn't seem to be recursive.
>>>>
>>>>Steve Kass
>>>>Drew University
>>>>
>>>>Alex wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>I have created the following procedure, which is returning the Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) error message.
>>>>>
>>>>>Your assistance is appreciated....
>>>>>
>>>>>BEGIN
>>>>>SET nocount on
>>>>>TRUNCATE TABLE sys_load -- load the sys_load table initially
>>>>>insert into dbo.sys_load (FirstName, LastName, Address, City, State, Zip, Phone, Prayer, DateEntered, Station)
>>>>>select "First Name", "Last Name", "Address", "City", "State", "Zip", "Phone", "Prayer", "Date Entered", "Station"
>>>>>from OpenRowset('Microsoft.Jet.OLEDB.4.0',
>>>>>'Excel 8.0;Database=C:\MyExcelog.xls',
>>>>>'select * from [Excel Export File$]')
>>>>>-- see if a record already exists for the new Donor
>>>>>declare @intId int, @FirstName nvarchar(64), @LastName nvarchar(64),@Country nvarchar(64), @Email nvarchar(64)
>>>>>declare donor cursor for
>>>>> select a.intId, a.FirstName, a.LastName, (case when Country='Canada' then 'TN' else 'TU' end) Country, a.Email
>>>>> from dbo.Donor a, dbo.sys_load b
>>>>> where a.FirstName = b.FirstName
>>>>> and a.LastName = b.LastName
>>>>>open donor
>>>>>fetch next from donor into @intId, @FirstName, @LastName, @Country, @Email
>>>>>while (@@FETCH_STATUS != -1)
>>>>>begin
>>>>>-- NO Donor Found with that FirstName, LastName
>>>>>if (@@FETCH_STATUS = -2)
>>>>> begin
>>>>> insert into dbo.Donor (FirstName, LastName, City, State, Zip, Phone,CompanyID, DateAdded)
>>>>> select a.FirstName, a.LastName, a.City, a.State, a.Zip, a.Phone, 1,getdate()
>>>>> from dbo.sys_load a
>>>>> fetch next from donor into @intId, @FirstName, @LastName, @Country, @Email
>>>>> print 'Record created in the Donor table'
>>>>> end
>>>>>else
>>>>> -- if donor record found, insert a new record into DonorDonations
>>>>> begin
>>>>> while (@@FETCH_STATUS = 0)
>>>>> begin
>>>>> insert into dbo.DonorDonations (intId, OrderTerms, CreditCardType,Amount, DateReceived, Source, Operator, LetterId, Status)
>>>>> values (@intId, 1, 0, 0, getdate(), @Country, @Email, @Country, 1)
>>>>> fetch next from donor into @intId, @FirstName, @LastName, @Country, @Email
>>>>> end
>>>>> end
>>>>>end
>>>>>close donor
>>>>>deallocate donor
>>>>>END
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
- Next message: Steve Kass: "Re: max sp, func, trig, or view nesting level..."
- Previous message: Mischa Sandberg: "Re: Search Multiple Columns with REGEXP"
- In reply to: Alex: "Re: max sp, func, trig, or view nesting level..."
- Next in thread: Alex: "Re: max sp, func, trig, or view nesting level..."
- Reply: Alex: "Re: max sp, func, trig, or view nesting level..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|