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
Gouache painting of a cream wrapped gift with a red ribbon on a patio table beside a pitcher of lemonade and a paper party hat

How to Calculate Age Correctly in SQL Server

July 30, 2008
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

Calculate Age in SQL Server by counting completed birthdays, not calendar years. This post compares DATEDIFF, a DATEADD correction and a compact integer version on a bike club table, handles February 29 birthdays and ends with a reusable function for age on any date.

Read More
SQL SERVER - SQL SERVER - Simple Example of Recursive CTE - Part 2 - MAXRECURSION - Prevent CTE Infinite Loop

SQL SERVER – SQL SERVER – Simple Example of Recursive CTE – Part 2 – MAXRECURSION – Prevent CTE Infinite Loop

July 29, 2008
Pinal Dave
SQL Tips and Tricks
CTE, SQL Joins, SQL Scripts

Can you stop a recursive CTE from running forever? Yes. Use the MAXRECURSION option to limit it, and see what happens when the limit is too low.

Read More
SQL SERVER - Simple Example of Recursive CTE

SQL SERVER – Simple Example of Recursive CTE

July 28, 2008
Pinal Dave
SQL Tips and Tricks
CTE, SQL Joins, SQL Scripts

A simple example of Recursive CTE in SQL Server, using AdventureWorks to walk the hierarchy of managers and employees, with each part explained.

Read More
SQL Object Explorer results window.

SQL SERVER – mssqlsystemresource – Resource Database

July 27, 2008
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Scripts, SQL System Table

What is mssqlsystemresource? It is the Resource Database, a read only database of system objects that makes upgrading SQL Server much easier.

Read More
SQL SERVER - 2005 -Track Down Active Transactions Using T-SQL

SQL SERVER – 2005 -Track Down Active Transactions Using T-SQL

July 24, 2008
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL System Table, SQL Transactions

Want to track down active transactions in your database? One simple DMV query on sys.dm_tran_session_transactions returns them in SQL Server 2005.

Read More
SQL SERVER - Clear SQL Server Memory Caches

SQL SERVER – Clear SQL Server Memory Caches

July 22, 2008
Pinal Dave
SQL Performance
SQL Scripts, SQL Server DBCC

Need to clear SQL Server memory caches on a production server you cannot restart? Three DBCC commands free up memory by cleaning the cache.

Read More
SQL SERVER - FIX - ERROR : 9004 An error occurred while processing the log for database. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.

SQL SERVER – FIX – ERROR : 9004 An error occurred while processing the log for database. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.

July 21, 2008
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Data Storage, SQL Error Messages, SQL Scripts

Error 9004 means an error occurred while processing the log for database, so it will not attach. Here are the steps that worked for me, starting with emergency mode.

Read More
Previous 1 … 308 309 310 311 312 313 314 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

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