Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difference between Stored Procedures & User Defined Functions

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
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.

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)
 
take a look at this recent thread on the same topic...

thread183-1106464

please search before posting...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top