Can anyone share me a light on how to create a subroutine in a stored procedure in SQL Server?
I have a procedures in Oracle that will call a subroutine within the same procedures for 50 times in different lines in the procedure. Now I want to recreate the same procedure in SQL Server. Could you share me some light on how to do this?
If your subroutine is performing data modifications (CRUD) or need to use temporary tables(#teporary_table) it needs to be stored procedure. In other cases, you can use create a function. You can choose from different types of functions depending on their complexity and return values:
SELECT
statement) and returns rowsetAlso, in SQL Server there is SQL CLR and you can create functions or procedures (or as called them "subroutines") in .net
code.