jordanking
Programmer
- Sep 8, 2005
- 351
Hello,
is there a way to pass a query set to a stored procedure like you can pass a SET based query to an insert statement
example:
a simple procedure
can this be done:
pass the query results to the procedure so it runs with each of the rows in the result set?
I get an error with the above code saying that the procedure expected a parameter that was not supplied
.....
I'd rather be surfing
is there a way to pass a query set to a stored procedure like you can pass a SET based query to an insert statement
example:
a simple procedure
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[ps_MyProcedure]
-- Add the parameters for the stored procedure here
@intMyTable int,
@chrMytable nvarchar(10),
@dtMyTable datetime
AS
BEGIN TRY
SET NOCOUNT ON;
BEGIN TRANSACTION
-- Insert statements for procedure here
INSERT INTO dbo.MyTable
(
intMyTable,
chrMyTable,
dtMyTable
)
VALUES
(
@intMyTable,
@chrMyTable,
@dtMyTable
)
COMMIT TRAN
RETURN 0
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION
END CATCH
can this be done:
Code:
EXECUTE [RegentSigns].[dbo].[ps_MyProcedure]
SELECT TOP 10 dbo.Residential.intResidential, 'test' AS chrTest, dbo.Residential.dtServiceDate
FROM dbo.Residential
I get an error with the above code saying that the procedure expected a parameter that was not supplied
.....
I'd rather be surfing