Click here to Skip to main content
15,900,511 members
Home / Discussions / Database
   

Database

 
GeneralRe: SELECT then INSERT data in a matrix way Pin
Farhad Eft9-Jul-15 10:51
Farhad Eft9-Jul-15 10:51 
QuestionSQL Linq, concepts of writing queries Pin
jkirkerx8-Jul-15 8:55
professionaljkirkerx8-Jul-15 8:55 
AnswerRe: SQL Linq, concepts of writing queries Pin
Richard Deeming8-Jul-15 10:46
mveRichard Deeming8-Jul-15 10:46 
GeneralRe: SQL Linq, concepts of writing queries Pin
jkirkerx8-Jul-15 12:32
professionaljkirkerx8-Jul-15 12:32 
Questionssrs rendering format ppt pptx Pin
Aurelkb5-Jul-15 23:35
Aurelkb5-Jul-15 23:35 
AnswerRe: ssrs rendering format ppt pptx Pin
Richard MacCutchan6-Jul-15 0:13
mveRichard MacCutchan6-Jul-15 0:13 
QuestionEvaluate returnvalues of stored procedures used in TableAdapterManager.UpdateAll Pin
atrus27113-Jul-15 1:49
atrus27113-Jul-15 1:49 
AnswerRe: Evaluate returnvalues of stored procedures used in TableAdapterManager.UpdateAll Pin
atrus27113-Jul-15 2:39
atrus27113-Jul-15 2:39 
QuestionOracle Query Builder Pin
Mycroft Holmes30-Jun-15 14:18
professionalMycroft Holmes30-Jun-15 14:18 
AnswerRe: Oracle Query Builder Pin
Jörgen Andersson7-Jul-15 8:40
professionalJörgen Andersson7-Jul-15 8:40 
QuestionEntity Framework 6.0.3 problem Pin
Mark Miller24-Jun-15 10:42
Mark Miller24-Jun-15 10:42 
AnswerRe: Entity Framework 6.0.3 problem Pin
Mark Miller1-Jul-15 9:49
Mark Miller1-Jul-15 9:49 
Questionstop accessing peoples SQL server through SQL management Studio. Pin
Azam Niaz Ch.21-Jun-15 9:06
Azam Niaz Ch.21-Jun-15 9:06 
AnswerRe: stop accessing peoples SQL server through SQL management Studio. Pin
PIEBALDconsult21-Jun-15 9:24
mvePIEBALDconsult21-Jun-15 9:24 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
Azam Niaz Ch.21-Jun-15 18:21
Azam Niaz Ch.21-Jun-15 18:21 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
PIEBALDconsult21-Jun-15 18:28
mvePIEBALDconsult21-Jun-15 18:28 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
scottgp22-Jun-15 1:19
professionalscottgp22-Jun-15 1:19 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
Eddy Vluggen22-Jun-15 1:36
professionalEddy Vluggen22-Jun-15 1:36 
AnswerRe: stop accessing peoples SQL server through SQL management Studio. Pin
Mycroft Holmes21-Jun-15 19:57
professionalMycroft Holmes21-Jun-15 19:57 
AnswerRe: stop accessing peoples SQL server through SQL management Studio. Pin
GuyThiebaut21-Jun-15 21:24
professionalGuyThiebaut21-Jun-15 21:24 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
Mycroft Holmes22-Jun-15 14:13
professionalMycroft Holmes22-Jun-15 14:13 
QuestionMaximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) Pin
indian14319-Jun-15 15:46
indian14319-Jun-15 15:46 
Hi All,

I am getting the following error when I am running the stored procedure.
Msg 217, Level 16, State 1, Procedure rptClassInformation_sel, Line 26. Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

When I remove the following part, it is not throwing that error. Can you please let me know where am I missing, am I making something wrong, is it related to Line 26 as in the message.
WITH CTE AS
    (
    SELECT FILTER.GroupKey,
        FILTER.ClassScheduleId,
        SUM(SlotCount) AS SlotCount
    FROM    #SlotInformation INFO
        INNER JOIN #Base FILTER
            ON FILTER.ClassScheduleId  = INFO.ClassScheduleId
            AND (
                    @Level = 'Class'
                OR  FILTER.UseInAggs = 1
                )
    WHERE   SlotPlanTypeId IN (@SLOTPLAN_ECEAP, @SLOTPLAN_ECEAPSPED)
    GROUP BY
        FILTER.GroupKey,
        FILTER.ClassScheduleId
    )

INSERT  INTO #Results
    (GroupKey, Identifier, Name, Value)
SELECT  WEEK.GroupKey,
    'NIEER' AS Identifier,
    'Number of ECEAP slots in ECEAP classes meeting 8 or more hours per day' AS Name,
    SUM(CASE WHEN WEEK.AverageHoursPerDay >= 8 THEN CTE.SlotCount ELSE 0 END) AS Value
FROM    #WeeklyOverview WEEK
    INNER JOIN CTE
        ON CTE.GroupKey = WEEK.GroupKey
        AND CTE.ClassScheduleId = WEEK.ClassScheduleId
GROUP BY
    WEEK.GroupKey

UNION ALL

SELECT  WEEK.GroupKey,
    'NIEER' AS Identifier,
    'Number of ECEAP slots in ECEAP classes meeting at least 4 hours but fewer than 8 hours per day' AS Name,
    SUM(CASE WHEN WEEK.AverageHoursPerDay >= 4 AND WEEK.AverageHoursPerDay < 8 THEN CTE.SlotCount ELSE 0 END) AS Value
FROM    #WeeklyOverview WEEK
    INNER JOIN CTE
        ON CTE.GroupKey = WEEK.GroupKey
        AND CTE.ClassScheduleId = WEEK.ClassScheduleId
GROUP BY
    WEEK.GroupKey

UNION ALL

SELECT  WEEK.GroupKey,
    'NIEER' AS Identifier,
    'Number of ECEAP slots in ECEAP classes meeting fewer than 4 hours per day' AS Name,
    SUM(CASE WHEN WEEK.AverageHoursPerDay < 4 THEN CTE.SlotCount ELSE 0 END) AS Value
FROM    #WeeklyOverview WEEK
    INNER JOIN CTE
        ON CTE.GroupKey = WEEK.GroupKey
        AND CTE.ClassScheduleId = WEEK.ClassScheduleId
GROUP BY
    WEEK.GroupKey;
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 22-Jun-15 12:59pm.

AnswerRe: Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) Pin
Richard Deeming22-Jun-15 1:41
mveRichard Deeming22-Jun-15 1:41 
GeneralRe: Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32) Pin
indian14322-Jun-15 7:00
indian14322-Jun-15 7:00 
QuestionHow to add primary key in existing table? Pin
apple blue16-Jun-15 16:53
apple blue16-Jun-15 16:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.