I have a question regarding the differences between stored procedures and user defined functions.
My understanding has always been that User Defined Functions can be embedded within T-SQL commands while stored procedures are executed as single line statements within a batch or another stored procedure .
Today I came across an example in a book that doesn’t fit my definition of a stored procedure as it returns a set of columns as input into an INSERT statement.
The Stored procedure is just a SELECT statement.
Are there any other circumstances in which a stored procedure can be used within a
T-SQL statement?
Dazed and confused
(N+, MCAD)
My understanding has always been that User Defined Functions can be embedded within T-SQL commands while stored procedures are executed as single line statements within a batch or another stored procedure .
Today I came across an example in a book that doesn’t fit my definition of a stored procedure as it returns a set of columns as input into an INSERT statement.
Code:
INSERT INTO MyFile1 ( MyColumn1, MyColumn2, MyColumn3 )
EXEC dbo.MyStoredProcedure1
The Stored procedure is just a SELECT statement.
Are there any other circumstances in which a stored procedure can be used within a
T-SQL statement?
Dazed and confused
(N+, MCAD)