Home » 2012 » September (Page 2)

Monthly Archives: September 2012

How to log SQL Server Custom Error in Windows Event Log ?

SQL server gives an option to log custom errors in windows event log. We have 2 options of achieving this. Option 1 : Using xp_logevent BEGIN TRY SELECT 10/0 END TRY BEGIN CATCH PRINT ERROR_Message() DECLARE @msg VARCHAR(100) SELECT @msg = ERROR_Message() –xp_logevent error_number , errormessage, severity (INFORMATIONAL, WARNING, or ERROR) EXEC xp_logevent 60000, @msg, … Continue reading

Surface Area Configuration tool available in SQL Server 2008 & onwards

Surface area configuration is a security measure that involves stopping or disabling unused components. Surface area configuration helps to improve security by providing fewer avenues for potential attacks on a system. Surface Area Configuration too is introduced in SQL Server 2005 & Direct access of Surface Area Configuration tool has been removed from SQL server 2008 onwards. … Continue reading

21 Different Ways to Connect to SQL Server Instance

Today, A weird though come into mind to check the different way to connect to SQL Server instance. Diffrent strings, I can pass in Server Name in SSMS to connect. I am surprised but I got 21 different way to connect & may be there are many more ways. I am connecting to the default … Continue reading

SQL Server || Query Execution plan from XML to Graphical View

1) We can get queries execution plan from below query SELECT –st.text, qs.EXECUTION_COUNT qs.*, cp.* FROM sys.dm_exec_query_stats AS qs CROSS APPLY sys.dm_exec_sql_text(sql_handle)AS st CROSS APPLY sys.dm_exec_query_plan(plan_handle) AS cp 2) Column query_plan is having execution plan in XML form 3) When we click hyperlink in query_plan column, in SQL 2005,2008 & 2008 R2 it open as … Continue reading

%d bloggers like this: