You are herequeries
queries
MS SQL Server: Functions, Stored Procedures, Dates, etc.
I'm happy to have learned how to use stored procedures(SP) and user-defined functions(UDF) recently. For a while now I have been using SELECT statements, but when I was asked to give a programmer the ability to call a query, I knew that a stored procedure would work better. A stored procedure lives on the SQL Server and can be called up over and over. Also, it allows different parameters to be used every time the SP is called.
EXEC sp_givemedata(param1,param2,param3)
In my case, I had a simple request to return the list of UniqueIDs from a table called Documents.