When to use stored procedure and when function in SQL Server 2008?
I use a lot of stored procedures, but every one of them has the same code select rows from table I have. I am returning the same table with every procedure, besides additional tables that are returned.
So, this table I am reading every time, should it be a Function or another stored procedure I should call?
Right now I have the same code lines repeated several times. If I am going to change the table I’m reading, I will need to change the code in all my stored procedure.
What is the right solution?
small SP that calling other SP, or using function?