|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi folks,
I've just developed an extended stored procedure in .net framework. It's being added to the SQL Server 2005, and it's executed properly. Now, I've got a user defined function as follows: CREATE FUNCTION [dbo].[GetItems]() RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) AS BEGIN EXEC dbo.[xspGetItemView] RETURN END WHERE xspGetItemView is the extended stored procedure. When I try to call the function this way: SELECT * FROM GetItems() I receive the following error: Msg 557, Level 16, State 2, Line 1 Only functions and extended stored procedures can be executed from within a function. However, as you see, the function is just trying to execute an extended stored procedure! So what's going wrong and how am I supposed to fix this? Thanks Jack |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Jack
Hope xspGetItemView returns 6 columns CREATE FUNCTION [dbo].[GetItems]() RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) AS BEGIN insert into @reports EXEC dbo.[xspGetItemView] RETURN END "jack" <ata@mailinator.com> wrote in message news:a501cb53-2cdb-40b5-b96c-e608b8db1638@79g2000hsk.googlegroups.com... > Hi folks, > I've just developed an extended stored procedure in .net framework. > It's being added to the SQL Server 2005, and it's executed properly. > Now, I've got a user defined function as follows: > > CREATE FUNCTION [dbo].[GetItems]() > RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] > NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) > AS > BEGIN > EXEC dbo.[xspGetItemView] > RETURN > END > > WHERE xspGetItemView is the extended stored procedure. When I try to > call the function this way: > > SELECT * FROM GetItems() > > I receive the following error: > > Msg 557, Level 16, State 2, Line 1 > Only functions and extended stored procedures can be executed from > within a function. > > However, as you see, the function is just trying to execute an > extended stored procedure! So what's going wrong and how am I supposed > to fix this? > > Thanks > Jack |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
ignore it..
"vinu" wrote: > Jack > > > Hope xspGetItemView returns 6 columns > > > CREATE FUNCTION [dbo].[GetItems]() > RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] > NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) > AS > BEGIN > insert into @reports > EXEC dbo.[xspGetItemView] > > > RETURN > END > > > > > > > "jack" <ata@mailinator.com> wrote in message > news:a501cb53-2cdb-40b5-b96c-e608b8db1638@79g2000hsk.googlegroups.com... > > Hi folks, > > I've just developed an extended stored procedure in .net framework. > > It's being added to the SQL Server 2005, and it's executed properly. > > Now, I've got a user defined function as follows: > > > > CREATE FUNCTION [dbo].[GetItems]() > > RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] > > NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) > > AS > > BEGIN > > EXEC dbo.[xspGetItemView] > > RETURN > > END > > > > WHERE xspGetItemView is the extended stored procedure. When I try to > > call the function this way: > > > > SELECT * FROM GetItems() > > > > I receive the following error: > > > > Msg 557, Level 16, State 2, Line 1 > > Only functions and extended stored procedures can be executed from > > within a function. > > > > However, as you see, the function is just trying to execute an > > extended stored procedure! So what's going wrong and how am I supposed > > to fix this? > > > > Thanks > > Jack > > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Hi
this might be full http://www.codeguru.com/csharp/.net/...le.php/c13561/ vinu "jack" <ata@mailinator.com> wrote in message news:a501cb53-2cdb-40b5-b96c-e608b8db1638@79g2000hsk.googlegroups.com... > Hi folks, > I've just developed an extended stored procedure in .net framework. > It's being added to the SQL Server 2005, and it's executed properly. > Now, I've got a user defined function as follows: > > CREATE FUNCTION [dbo].[GetItems]() > RETURNS @reports TABLE(Id INT, SubId INT, HLevel INT, [Name] > NVARCHAR(128), [Sku] NVARCHAR(16), ItemType NVARCHAR(16)) > AS > BEGIN > EXEC dbo.[xspGetItemView] > RETURN > END > > WHERE xspGetItemView is the extended stored procedure. When I try to > call the function this way: > > SELECT * FROM GetItems() > > I receive the following error: > > Msg 557, Level 16, State 2, Line 1 > Only functions and extended stored procedures can be executed from > within a function. > > However, as you see, the function is just trying to execute an > extended stored procedure! So what's going wrong and how am I supposed > to fix this? > > Thanks > Jack |
|
![]() |
| Outils de la discussion | |
|
|