I am trying to find documentation on SQL Server where concept of scope is defined. I just want to understand it better.
I had been looking at scope_identity()
function and it says that @@identity
result and scope_identity()
result will differ in case there are triggers defined which insert records into another table with an identity column.
It seems scope_identity()
decides that insert in the trigger is in different scope. I want to see how that is determined/where it is documented...
Views in SQL are kind of virtual tables. A view also has rows and columns as they are in a real table in the database. We can create a view by selecting fields from one or more tables present in the database. A View can either have all the rows of a table or specific rows based on certain condition.
SQL is a massive technology. The future scope of being an SQL Developer it is not just limited to Computer Science, but you can see it revolving around Retail, Finance, Healthcare, Science & Technology, Public Sector, in short everywhere. All organizations need a database for the storage of their data.
There are three types of user-defined functions in SQL Server: Scalar Functions (Returns A Single Value) Inline Table Valued Functions (Contains a single TSQL statement and returns a Table Set) Multi-Statement Table Valued Functions (Contains multiple TSQL statements and returns Table Set)
A user-defined function (UDF) lets you create a function by using a SQL expression or JavaScript code. A UDF accepts columns of input, performs actions on the input, and returns the result of those actions as a value. You can define a UDFs as either persistent or temporary.
A scope is a module: a stored procedure, trigger, function, or batch. Therefore, two statements are in the same scope if they are in the same stored procedure, function, or batch.
https://msdn.microsoft.com/en-us/library/ms190315.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With