Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Execute a procedure from within a SQL select
Message
De
29/11/2005 16:26:52
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01072912
Message ID:
01073015
Vues:
23
>>Hi, Mike,
>>
>>Any reason you can't turn that stored procedure into a UDF?
>>
>>Kevin
>
>There is already fairly complicated working stored procedure that handles this process that we would like to use and not duplicate.

Mike,
.
.
.
if exists(select [name] from tempdb..sysobjects where [name] = '#MyResults')
DROP TABLE #MyResults

CREATE TABLE #MyResults (
ResultID int NOT NULL CLUSTERED PRIMARY KEY IDENTITY (1,1),
MyResult varchar(20)
)

INSERT INTO #MyResults
EXEC MyStoredProcedure @p1 = 'Hello', @p2 = 'World'

SELECT * FROM #MyResults

if exists(select [name] from tempdb..sysobjects where [name] = '#MyResults')
DROP TABLE #MyResults
.
.
.
GO
CREATE PROCEDURE MyStoredProcedure (
@p1 varchar(10),
@p2 varchar(10)
)
AS
SELECT @p1 + ' ' + @p2 as MyResult
GO
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform