What is the difference between a candidate key and a primary key? A table can have many candidate keys, but only one of them becomes the primary key.
APPROX_COUNT_DISTINCT in SQL Server: Saves Memory, Not Time
APPROX_COUNT_DISTINCT counts distinct values with almost no memory. Tested on 5 million rows, it was within 2.2 percent of the exact count and needed no memory grant, while COUNT(DISTINCT) asked for 436 MB. It was not faster.
SQL SERVER – Interesting Observation of Logon Trigger On All Servers
I created a Logon Trigger to audit every successful login for a client, and one login was recorded several times on different threads. The script and what I saw.
SQL SERVER – Find Hostname and Current Logged In User Name
Connected to many servers in SSMS? HOST_NAME() and SUSER_NAME() show the hostname and current logged in user for any query window.
Reading System Procedures With OBJECT_DEFINITION
Use OBJECT_DEFINITION and sys.system_sql_modules to read visible SQL Server system procedure text and learn how built-in tools work.
SQL SERVER – Introduction to Business Intelligence – Important Terms and Definitions – 2
Important terms and definitions in business intelligence, explained in plain words and grouped by how data moves from source systems to reports.






