|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange result associated with execution of stored procedureI got a stored procedure which is as following: CREATE PROCEDURE sp_parmSailorRanking @ClubCode varchar(50), @Rank varchar(10) AS SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, Rank.Rank FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID WHERE (((People.PeopleClubCode)=@ClubCode) AND ((Rank.Rank)<=@Rank)) ORDER BY Rank.Year, Rank.Month, Rank.Rank; When I am issuing a command as below: Exec sp_parmSailorRanking 'SCOW', 10 I am getting message stating 18 rows updated for a number of times and then the following error message comes up: Server: Msg 217, Level 16, State 1, Procedure sp_parmSailorRanking, Line 11 Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32). However, if I just run the sql select code with the same parameter which comes to as SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, Rank.Rank FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID WHERE (((People.PeopleClubCode)='SCOW') AND ((Rank.Rank)<=10)) ORDER BY Rank.Year, Rank.Month, Rank.Rank; I get a resultset showing various columns and rows as expected. I would appreciate what's wrong when I run the stored procedure from the QA. Thanks in advance. are you sure that's the whole stored procedure?
Jack wrote: Show quote > Hi, > I got a stored procedure which is as following: > CREATE PROCEDURE sp_parmSailorRanking > @ClubCode varchar(50), > @Rank varchar(10) > AS > SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > Rank.Rank > FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > WHERE (((People.PeopleClubCode)=@ClubCode) AND ((Rank.Rank)<=@Rank)) > ORDER BY Rank.Year, Rank.Month, Rank.Rank; > > When I am issuing a command as below: > Exec sp_parmSailorRanking 'SCOW', 10 > I am getting message stating 18 rows updated for a number of times and then > the following error message comes up: > > Server: Msg 217, Level 16, State 1, Procedure sp_parmSailorRanking, Line 11 > Maximum stored procedure, function, trigger, or view nesting level exceeded > (limit 32). > > However, if I just run the sql select code with the same parameter which > comes to as > SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > Rank.Rank > FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > WHERE (((People.PeopleClubCode)='SCOW') AND ((Rank.Rank)<=10)) > ORDER BY Rank.Year, Rank.Month, Rank.Rank; > > I get a resultset showing various columns and rows as expected. I would > appreciate what's wrong when I run the stored procedure from the QA. Thanks > in advance. Yes, that is indeed the whole stored procedure. Thanks.
Show quote "Trey Walpole" wrote: > are you sure that's the whole stored procedure? > > Jack wrote: > > Hi, > > I got a stored procedure which is as following: > > CREATE PROCEDURE sp_parmSailorRanking > > @ClubCode varchar(50), > > @Rank varchar(10) > > AS > > SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > > People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > > Rank.Rank > > FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > > WHERE (((People.PeopleClubCode)=@ClubCode) AND ((Rank.Rank)<=@Rank)) > > ORDER BY Rank.Year, Rank.Month, Rank.Rank; > > > > When I am issuing a command as below: > > Exec sp_parmSailorRanking 'SCOW', 10 > > I am getting message stating 18 rows updated for a number of times and then > > the following error message comes up: > > > > Server: Msg 217, Level 16, State 1, Procedure sp_parmSailorRanking, Line 11 > > Maximum stored procedure, function, trigger, or view nesting level exceeded > > (limit 32). > > > > However, if I just run the sql select code with the same parameter which > > comes to as > > SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > > People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > > Rank.Rank > > FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > > WHERE (((People.PeopleClubCode)='SCOW') AND ((Rank.Rank)<=10)) > > ORDER BY Rank.Year, Rank.Month, Rank.Rank; > > > > I get a resultset showing various columns and rows as expected. I would > > appreciate what's wrong when I run the stored procedure from the QA. Thanks > > in advance. > Show the DDL of the tables/views involved. There is more to this story than
what you included. ok then, how about any procs with the same name but a different owner?
[btw: sp_ to start a procedure is not recommended, as this is a convention that SQL uses internally for system procedures...] e.g. dbo.sp_parmSailorRanking jack.sp_parmSailorRanking there must be more code, especially since what's posted doesn't even have 11 lines of code in it... Jack wrote: Show quote > Yes, that is indeed the whole stored procedure. Thanks. > > "Trey Walpole" wrote: > > >>are you sure that's the whole stored procedure? >> >>Jack wrote: >> >>>Hi, >>>I got a stored procedure which is as following: >>>CREATE PROCEDURE sp_parmSailorRanking >>> @ClubCode varchar(50), >>> @Rank varchar(10) >>>AS >>>SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, >>>People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, >>>Rank.Rank >>>FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID >>>WHERE (((People.PeopleClubCode)=@ClubCode) AND ((Rank.Rank)<=@Rank)) >>>ORDER BY Rank.Year, Rank.Month, Rank.Rank; >>> >>>When I am issuing a command as below: >>>Exec sp_parmSailorRanking 'SCOW', 10 >>>I am getting message stating 18 rows updated for a number of times and then >>>the following error message comes up: >>> >>>Server: Msg 217, Level 16, State 1, Procedure sp_parmSailorRanking, Line 11 >>>Maximum stored procedure, function, trigger, or view nesting level exceeded >>>(limit 32). >>> >>>However, if I just run the sql select code with the same parameter which >>>comes to as >>>SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, >>>People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, >>>Rank.Rank >>>FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID >>>WHERE (((People.PeopleClubCode)='SCOW') AND ((Rank.Rank)<=10)) >>>ORDER BY Rank.Year, Rank.Month, Rank.Rank; >>> >>>I get a resultset showing various columns and rows as expected. I would >>>appreciate what's wrong when I run the stored procedure from the QA. Thanks >>>in advance. >> Thanks for your help guys. By changing the rank to int instead of varchar,
the problem got solved. Best regards. Show quote "Trey Walpole" wrote: > ok then, how about any procs with the same name but a different owner? > [btw: sp_ to start a procedure is not recommended, as this is a > convention that SQL uses internally for system procedures...] > > e.g. > dbo.sp_parmSailorRanking > jack.sp_parmSailorRanking > > there must be more code, especially since what's posted doesn't even > have 11 lines of code in it... > > > > > Jack wrote: > > Yes, that is indeed the whole stored procedure. Thanks. > > > > "Trey Walpole" wrote: > > > > > >>are you sure that's the whole stored procedure? > >> > >>Jack wrote: > >> > >>>Hi, > >>>I got a stored procedure which is as following: > >>>CREATE PROCEDURE sp_parmSailorRanking > >>> @ClubCode varchar(50), > >>> @Rank varchar(10) > >>>AS > >>>SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > >>>People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > >>>Rank.Rank > >>>FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > >>>WHERE (((People.PeopleClubCode)=@ClubCode) AND ((Rank.Rank)<=@Rank)) > >>>ORDER BY Rank.Year, Rank.Month, Rank.Rank; > >>> > >>>When I am issuing a command as below: > >>>Exec sp_parmSailorRanking 'SCOW', 10 > >>>I am getting message stating 18 rows updated for a number of times and then > >>>the following error message comes up: > >>> > >>>Server: Msg 217, Level 16, State 1, Procedure sp_parmSailorRanking, Line 11 > >>>Maximum stored procedure, function, trigger, or view nesting level exceeded > >>>(limit 32). > >>> > >>>However, if I just run the sql select code with the same parameter which > >>>comes to as > >>>SELECT People.PeopleID, People.PeopleNameLast, People.PeopleNameFirst, > >>>People.PeopleProfessionalClass, People.PeopleClubCode, Rank.Year, Rank.Month, > >>>Rank.Rank > >>>FROM People INNER JOIN Rank ON People.PeopleID = Rank.SailorID > >>>WHERE (((People.PeopleClubCode)='SCOW') AND ((Rank.Rank)<=10)) > >>>ORDER BY Rank.Year, Rank.Month, Rank.Rank; > >>> > >>>I get a resultset showing various columns and rows as expected. I would > >>>appreciate what's wrong when I run the stored procedure from the QA. Thanks > >>>in advance. > >> > |
|||||||||||||||||||||||