Facebook
Welcome to Techsapphire

queries

SQL Complex quries Interview question

Read complete article

SQL XML Queries

SQL XML: You can generate XML from SQL queries without even doing single line of code in your programming language. Below is the script used in above video: –Query 1 select 1 as tag,null as parent,c.customerid as [Customers!1!Customerid],null as [order!2!orderid]from customers c inner join orders oon o.customerid=c.customeridunionselect 2 as tag,1 as parent,c.customerid,o.orderidfrom customers c inner […]

Finding expensive queries in SQL Server and performance optimization

Finding expensive queries can be challenging on SQL Server, this tutorial will help you in finding expensive queries on production. Using below DMVs: SYS.DM_EXEC_QUERY_STATS SYS.DM_EXEC_SQL_TEXT SYS.DM_EXEC_CACHED_PLANS SYS.DM_EXEC_TEXT_QUERY_PLAN First is using average logical reads, execution count and total worker time. But still people can use other combinations as well. I have also explained how missing index […]