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
Two panels comparing separate INSERT statements with one multi-row INSERT when book 4 is a duplicate key. Separate statements save book 11 and leave 9 books. The multi-row INSERT saves nothing and leaves 8 books

Multi-Row INSERT in SQL Server: One Statement, All or Nothing

August 6, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Table Operation, SQL Transactions

A multi-row INSERT adds several rows with one statement, using a list of value groups separated by commas. This post compares it with separate INSERT statements on a small table of books. It shows that one bad row undoes the whole statement, and it covers the errors and the 1,000 row limit.

Read More
Result of a LEFT JOIN from six plants to their order lines. Orchid, Bamboo and Mint show NULL in the LineID column, and the filter LineID IS NULL keeps only those three

Unmatched Records Query: Four Ways to Find Rows With No Match

August 5, 2011
Pinal Dave
SQL Tips and Tricks
SQL Joins, SQL NULL, SQL Scripts, SQL Sub Query

An unmatched records query finds the rows in one table that have no partner in another, such as plants that never sold. This post runs four versions on a small table: LEFT JOIN with a NULL test, NOT EXISTS, NOT IN and EXCEPT. It also shows the NULL trap that makes NOT IN return nothing.

Read More
Two boxes joined by an arrow. Phase one, organize, runs SELECT star in three steps that return 4, 7 and 5 rows. Phase two, itemize, swaps the star for a column list and returns the same 5 rows

Build a Query in Two Phases: Organize First, Itemize Second

August 4, 2011
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL Coding Standards, SQL Joins, SQL Scripts

Build a query in two phases: organize first, itemize second. Phase one gets the tables, joins and filter working with SELECT *, and phase two swaps the star for a column list. This post shows the method on a small branch and staff table, and the three errors it helps you avoid.

Read More
Table of eight shop names with the character code of each apostrophe and whether LIKE found it. Three straight marks, code 39, were found. Two curly marks, code 8217, were not found

Finding Apostrophes in SQL Server Text: Straight and Curly

August 3, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Search, SQL String, Unicode

Finding apostrophes in SQL Server text takes one trick and one trap. The trick is doubling the quote inside a LIKE pattern. The trap is that text can hold a curly apostrophe, and the usual search skips it. This post tests both on a table of eight shop names.

Read More
Three LIKE symbols shown as cards: percent sign, underscore and open bracket, each with the number of rows that contain it next to the number of rows LIKE found, and a row of plain symbols whose counts matched

Special Characters in a LIKE Pattern: Which Ones Are Wildcards

August 2, 2011
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Scripts, SQL Search, SQL String

Special characters in a LIKE pattern can match the wrong rows, because three symbols mean more than themselves. This post tests every common symbol on one small table. It shows how to search for a percent sign, an underscore and a bracket, and why a space in the pattern counts.

Read More
Four LIKE wildcards with a real example each: percent matches Baker and Brooks for B percent, underscore finds Baker, Patel and Taylor for underscore a percent, [A-K] returns five names, and [^A-K] returns nine

Wildcard Basics in SQL Server: How LIKE Patterns Work

August 1, 2011
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Scripts, SQL Search, SQL String

Wildcard basics for SQL Server: how LIKE works with %, _, sets and ranges, shown on one small table of last names. It also covers the mistakes with equal signs and sets, case and accents in ranges, and matching a wildcard literally. Every result comes from SQL Server 2025.

Read More
SQL SERVER - Interview Questions and Answers - Guest Post by Rick Morelan - Day 27 of 31

SQL SERVER – Interview Questions and Answers – Guest Post by Rick Morelan – Day 27 of 31

July 27, 2011
Pinal Dave
SQL Interview Questions and Answers
SQL Order By, SQL Scripts, SQL Server, SQL Server Security

A guest post by Rick Morelan, author of the Joes 2 Pros series, on the few interview questions that come up again and again and separate good answers from great.

Read More
Previous 1 … 225 226 227 228 229 230 231 … 363 Next
  • Books
  • Testimonials
  • Privacy Policy

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