Is it allowed to perform DDL/DML operations on tables in the procedure?

892    Asked by LiamDyer in SQL Server , Asked on Jan 17, 2020
Answered by Rachit Gupta

Yes DML operations (update/insert/ delete) are allowed in the procedure also (DDL: such as create/ alter/drop/ truncate) is also allowed in the procedures.

In case if the procedure will get executed in parallel then DDL on permanent table is not recommended as there could be chances that one procedure has already created a permanent table and another procedure is trying to create a table then one procedure may fail.

However it is recommended to use DDL statements if they exist and transactions should be used elsewhere there will be a chance of failing a procedure.



Your Answer

Interviews

Parent Categories