SQL Server – Dynamic SQL – SQL Injection – EXEC [ QUOTENAME() , REPLACE() , EXECUTE AS ] – Sp_executesql – [ RECOMPILE ]

Recently I had mess up with dynamic SQL , So whats next !!! , I started to explore on this topic and post it here , when I googled to gather some information , but what I found was , this topic has been already drilled to the core , carved and with the sculpture…

Details

SQL Server – Capturing Missing Join Predicate for queries using Extended Events

missing_join_predicate , one of the event  –  ” Occurs when an executed query is missing a join predicate. Use this event to identify a query that may perform slowly because of the missing predicate. This event only occurs if both sides of the join return more than one row ” . SELECT * FROM sys.dm_xe_objects…

Details

TSQL Script to Generate Create ColumnStore Index Script

 This article is about the TSQL script which can be used to generate create ColumnStore Index script from the database .SET CONCAT_NULL_YIELDS_NULL OFF; SELECT ‘ CREATE ‘ + I.type_desc COLLATE DATABASE_DEFAULT +’ INDEX ‘ + QUOTENAME(I.name)  + ‘ ON ‘  + QUOTENAME(Schema_name(T.Schema_id))+’.’+QUOTENAME(T.name) + ‘ ( ‘ + KeyColumns + ‘ )  WITH (‘ + —…

Details

Sql Server – All about Statistics

STATISTICS Statistics holds information about distribution of data in tables & indexes. Statistics helps the optimiser in creating efficient plan. EXAMPLES:  SET  “Auto Create Statistics ” & “Auto Update Statistics” in database properties   =   ‘FALSE’ CREATE TABLE TEST (Col1  INT ,Col2 VARCHAR(20),Col3 VARCHAR(20)) ;WITH CTE (Col1,Col2,Col3) AS( SELECT Col1 = 1,Col2 = ‘unique column’ +…

Details