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
Three distinct stamps match three clay impressions beside a separate blank fallback tile.

SQL SERVER – How to Use Decode in SQL Server?

April 23, 2011
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

CASE expresses the DECODE mapping in this SQL Server example. I keep the named matches and default value explicit.

Read More
SQL server error message dialog.

SQL SERVER – Prevent Constraint to Allow NULL

April 21, 2011
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts

Why does a CHECK constraint allow NULL? A reader thought it was a bug. I show why it happens and how to write the constraint so NULL is rejected too.

Read More
Two overlapping pale ceramic tiles beside a terracotta slab and blue and sage stones.

geometry STDistance: Measure the Closest Points of Two Shapes

April 19, 2011
Pinal Dave
SQL Tips and Tricks
Spatial Database, SQL Function, SQL Scripts, SQL Server

geometry STDistance measures the shortest distance between points belonging to two represented shapes. I compare an interior gap with an endpoint gap. Intersecting shapes provide a useful zero-distance case.

Read More
SQL SERVER - Applying NOLOCK Hint at Query Level - NOLOCK for whole Transaction

SQL SERVER – Applying NOLOCK Hint at Query Level – NOLOCK for whole Transaction

April 17, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts

Can you apply the NOLOCK hint to a whole query with OPTION (NOLOCK)? No, it fails with Msg 102. Here is how I use an isolation level instead.

Read More
An open ledger on a reading stand with a thin sheet of glass laid over the pages.

SQL SERVER – Making Database to Read Only – Changing Database to Read/Write

April 16, 2011
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Scripts, SQL Server

A reader attached a client database and it showed as Read Only. Two simple ALTER DATABASE scripts switch a database to READ_ONLY and back to READ_WRITE.

Read More
SQL SERVER - Finding Location of Log File when Primary Datafile is Crashed

SQL SERVER – Finding Location of Log File when Primary Datafile is Crashed

April 15, 2011
Pinal Dave
SQL Puzzle
SQL Scripts

Do you need the primary datafile to back up the log after a crash? Vinod Kumar asked, so I tried finding the location of the log file without it.

Read More
Recent queries list.

SQL SERVER – Query to Recent Query on Server with Execution Plan Function to Get SQL

April 12, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts

For T-SQL Tuesday on the APPLY clause, I share the script I use to see each recent query on server along with its execution plan from the cache.

Read More
Previous 1 … 231 232 233 234 235 236 237 … 363 Next
  • Books
  • Testimonials
  • Privacy Policy

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