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 plumber's hands fitting a brass valve into a central copper pipe, with branch pipes running off to different rooms.

Renaming a Column Safely Everywhere It Is Used

October 1, 2012
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL Column, SQL Server, SQL Stored Procedure, SQL View

Renaming a column safely requires finding SQL and application references, applying sp_rename, refreshing modules, and testing every consumer.

Read More
A white picket fence around a neat vegetable bed with a red gate latch and one tall sunflower standing out of line inside.

Create Constraints Quiz: What Does WITH NOCHECK Leave Behind?

January 18, 2012
Pinal Dave
SQL Puzzle
Primary Key, SQL Column, SQL Constraint and Keys, SQL Table Operation

This Create Constraints Quiz adds a CHECK constraint WITH NOCHECK to a table that already holds a bad row. The bad row stays, and the constraint is marked not trusted. A tested script proves it, shows what trust changes for the optimizer and lists four ways to create a constraint.

Read More
Three open boxes of different sizes, each holding three dark balls, one ball in each box painted red.

CHAR, VARCHAR, NVARCHAR and VARCHAR(MAX) Quiz: How Many Bytes?

January 16, 2012
Pinal Dave
SQL Puzzle
SQL Column, SQL Datatype, SQL String, Unicode

This CHAR, VARCHAR, NVARCHAR and VARCHAR(MAX) Quiz stores the text abc in three columns and asks how many bytes each one uses. The answer is 10, 3 and 6. A tested script proves it and shows the trailing space trap, the question mark problem and the 8,000 byte limit.

Read More
A kitchen sieve with a red rim over a bowl of green lentils, a blank paper tag lying loose beside it.

WHERE Clause Quiz: Why Can’t It See My Column Alias?

January 5, 2012
Pinal Dave
SQL Puzzle
CTE, SQL Column, SQL Error Messages, SQL Order By

This WHERE Clause Quiz asks what happens when a query filters on a column alias. The answer is error 207, because WHERE runs before SELECT. A tested script shows three working fixes and a trap where an alias hides a real column.

Read More
A hand holding a long cinnamon stick against a short glass spice vial that it clearly does not fit.

Checking Data Fits Before Narrowing a Column Data Type

May 16, 2011
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Datatype, SQL Server, SQL Table Operation

Check existing values before narrowing a column, account for dependencies and data loss, and plan the locking cost of the change.

Read More
A fingertip touching one strand of a dewy spider web in a garden, drops trembling across the whole web

Finding Every Object That Uses a Column

December 11, 2010
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Dependency, SQL Server, SQL System Table

Find an object that uses a column with dependency metadata and module text search, then check dynamic SQL and application code.

Read More
Water poured from a jug overflows a small espresso cup into its saucer.

Computed Column Data Types: Why the Result Type Surprises You

September 29, 2008
Pinal Dave
SQL Tips and Tricks
Computed Column, SQL Column, SQL Datatype, SQL Error Messages

Your table accepts every insert, then the report dies with an overflow error. Here is why the type is inherited and the cast that fixes it.

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

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