Posts

Showing posts from October, 2019

Except in Sql

It's a wonderful functionality in SQL. You may have crossed the situation to select the records those are not available in the second table. However We may use joins to do this. Alternatively we have  direct way to do this by using "Except" keyword. I hope this would be more helpful for you. We must have equal number of expressions in both queries. Example select invoiceid from invoicepayment where invoiceid in(1,2,3) Except select invoiceid from invoice where invoiceid in(1,2) Output 3

Standared Stored procedure structure

Today I'm going to tell you what's the standard way of writing stored procedures. Create proc procedurename Parameters with default value As Begin      Begin try           Begin tran                                         Commit tran       End try       Begin catch              If @@trancount >0              Rollback tran        End catch End