PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > Executing an extended stored proc from within a function!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Executing an extended stored proc from within a function!

Réponse
 
LinkBack Outils de la discussion
Vieux 17/06/2008, 13h15   #1
jack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Executing an extended stored proc from within a function!

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
  Réponse avec citation
Vieux 17/06/2008, 13h36   #2
vinu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Executing an extended stored proc from within a function!

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



  Réponse avec citation
Vieux 17/06/2008, 14h09   #3
vinu thomas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Executing an extended stored proc from within a function!

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

>
>
>

  Réponse avec citation
Vieux 17/06/2008, 14h24   #4
vinu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Executing an extended stored proc from within a function!

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



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h32.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10174 seconds with 12 queries