Question. Can an INSERT query return a value?
Answer: Yes
SQL Query
![user typeid]()
C# Code
Question. How to determine the Last Row identity?
Answer
Output
![last row id]()
Question. How to get the latest rows against an attribute in a table?
Answer
Query output
![rank]()
From this, we can see that the latest approved work id has the rank 1.
Now we can re-write our query as.
Then it will return only the latest row of data against each attribute in the partition by clause.
Question. Update the table with a Join query.
Answer
Before updating
![user id]()
After updating
![user id after update]()
Question. How to determine whether a table exists in the database?
Answer
For example
![table]()
Question. How to determine a procedure using a Query?
Answer
For example
![create procedure]()
Question. How do we determine whether a specific table is used in any stored procedures?
Answer
SELECT DISTINCT so.name FROM syscomments sc INNER JOIN
sysobjects so on sc.id=so.id WHERE sc.text LIKE '%table_name%'
For example
![ASUsetActivityReport]()
Summary
In this article, we learned about some valuable commands in SQL.