This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
A still weaving loom continues to hold unfinished fabric under tension

How to Kill Processes Idle for X Hours? – Interview Question of the Week #152

December 17, 2017
Pinal Dave
SQL Interview Questions and Answers
SQL Connection, SQL Cursor, SQL Scripts, SQL Server, System Object

Interview question: how to kill processes idle for X hours in SQL Server? Here is a script that finds idle sessions and kills them.

Read More
SELECT top 3.

SQL SERVER – What is the query used in sp_cursorfetch and FETCH API_CURSOR?

January 10, 2015
Pinal Dave
SQL Tips and Tricks
SQL Cursor

Activity Monitor shows FETCH API_CURSOR instead of the real query? I explain what sp_cursorfetch is and how to find the query running behind the cursor.

Read More
A sewing machine stitching a long straight seam, a red spool turning on top.

Cursor Options That Matter: LOCAL, FAST_FORWARD and STATIC

November 24, 2012
Pinal Dave
SQL Tips and Tricks
SQL Cursor, SQL Server, SQL Stored Procedure, SQL TempDB

Test SQL Server cursor options, including LOCAL FAST_FORWARD and STATIC, on one loop while measuring time and tempdb cost.

Read More
An egg slicer lowers parallel wires through one egg beside individually cut egg slices

Replacing a Running Total Cursor With a Window Function

March 16, 2012
Pinal Dave
SQL Tips and Tricks
SQL Cursor, SQL Function, SQL Order By, Temp Table

That loop adding to a variable can usually become one window function. Here is the proof that the balances match, and the tie trap to watch for.

Read More
A small wooden podium on a plain floor with red ribbons laid across the top step.

Ranking Functions Quiz: ROW_NUMBER, RANK or DENSE_RANK?

January 9, 2012
Pinal Dave
SQL Puzzle
Ranking Functions, SQL Cursor, SQL Function, SQL Order By

This Ranking Functions Quiz uses two tied scores to ask what number the next student gets from ROW_NUMBER, RANK and DENSE_RANK. The answer is 3, 3 and 2. A tested script proves it and replaces a cursor loop with one query.

Read More
Hens filing up a ramp into a wooden coop at dusk while one small red hen wanders alone in the yard.

Counting Users, Roles and Orphans in Every Database

December 25, 2011
Pinal Dave
SQL Tips and Tricks
DBA, Schema, SQL Cursor, SQL Login, SQL Server Security

Audit counting users across databases, include roles and schema ownership, and distinguish orphaned SQL users from contained identities.

Read More
SQL SERVER - 2008 - 2005 - Rebuild Every Index of All Tables of Database - Rebuild Index with FillFactor

SQL SERVER – 2008 – 2005 – Rebuild Every Index of All Tables of Database – Rebuild Index with FillFactor

January 30, 2009
Pinal Dave
SQL Performance
SQL Cursor, SQL Index, SQL Scripts

A quick script to rebuild every index of all tables in a database with a fillfactor of 80, plus a short note on what fillfactor does to leaf-level pages.

Read More
Previous 1 2 3 4 5 6 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com