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 heap of pears beside a grey wooden crate, a blue crate and an open vermilion crate

SELECT INTO Table Variable: Why It Fails and What to Use

March 2, 2020
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Table Operation, SQL Variable, Temp Table

SELECT INTO table variable fails with Msg 102 because SELECT INTO creates its target table and a table variable must be declared first. This post shows two working fixes, a declared table variable and a temp table. It also compares them on rollback, dynamic SQL and row estimates.

Read More
A lacrosse stick transferring a ball from an unused basket toward an active basket

Counting Ranked-Choice Votes With a Loop and a Table

February 6, 2020
Pinal Dave
SQL Tips and Tricks
SQL System Table, SQL Table Operation, Table Partitioning, Temp Table

Four people rank three topics and nobody has a majority. Here is a small loop that eliminates the weakest topic, moves its ballots and logs every round.

Read More
A checkered cloth spread on market cobblestones as a makeshift stall, with a short row of lemons and one blood orange.

The VALUES Table Constructor: Using a List as a Table

December 24, 2019
Pinal Dave
SQL Tips and Tricks
SQL Joins, SQL Scripts, SQL Server, SQL Table Operation, Temp Table

Use a VALUES table constructor for inline mappings and joins, understand the INSERT row limit, and move larger reusable lists into tables.

Read More
A fitted drawer belongs to one cabinet while a neighboring cabinet has an empty recess.

SQL Puzzle – Schema and Table Creation – Answer Without Running Code

October 15, 2019
Pinal Dave
SQL Puzzle
Schema, SQL Scripts, SQL Server, SQL Table Operation

This Table Creation puzzle asks for an explanation before you run its code. I suggest examining the batch separators carefully.

Read More
Gouache painting of a vase under a glass dome fastened with a vermilion clasp next to an unfinished clay pot

SCHEMABINDING View: What You Can Change in the Table

October 7, 2019
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Table Operation, SQL View

A SCHEMABINDING view locks the columns it uses and leaves the other columns of the table free. This post tests which changes SQL Server blocks, shows the messages and lists the bound columns with a query. It also shows how to change a bound column inside one transaction.

Read More
A hammock depends on two firmly connected supporting trees

What is SCHEMABINDING in SQL Server Views? – Interview Question of the Week #245

October 6, 2019
Pinal Dave
SQL Interview Questions and Answers
SQL Scripts, SQL Server, SQL Table Operation, SQL View

SCHEMABINDING keywords prevent tables used in the views to make any such modifications that can affect the view’s definition. 

Read More
Gouache painting of three flower stems clipped in one cut by vermilion shears on a florist's bench

Drop Multiple Columns in One ALTER TABLE Statement

October 2, 2019
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Scripts, SQL Table Operation

To drop multiple columns, list them after one DROP COLUMN in one ALTER TABLE statement. This post tests the syntax on a table with a default, a check constraint and an index, shows the error that a dependent object causes and drops the constraints and columns together. It also explains why the disk space doesn’t return until a rebuild.

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

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