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 detached ceramic lid beside an empty pale cup and a blue cup holding a stone on sage cloth.

FOR XML XSINIL: Emit Missing Fields as Explicit Nil Elements

August 10, 2011
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL XML

FOR XML XSINIL can represent SQL NULL with an explicit element carrying the xsi:nil attribute. I compare that output with ordinary element omission. An empty string stays a separate input in both versions.

Read More
Two results for the same eight trip costs. SUM(Cost) returns one row, 1385.00. SUM(Cost) OVER ( ) returns all eight rows with 1385.00 beside each one

Aggregates With the OVER Clause: A Total Beside Every Row

August 10, 2011
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Group By, SQL Scripts, SQL Server

Aggregates with the OVER clause put a total, an average or a minimum next to every row, so the rows do not collapse into one. This post uses eight trip costs to show the error a plain SUM gives, the fix, and the percent of the total for each row. It also shows how WHERE changes the total and how to filter on the result.

Read More
Five rows of ID boxes. At the start the IDs are 1 to 5. After deleting 4 and 5, a new row gets ID 6. After restoring 4 and 5 with IDENTITY_INSERT on, the next new row gets ID 7

Overriding Identity Fields: Put a Deleted Row Back With Its Old ID

August 9, 2011
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Identity, SQL Scripts, SQL Server

Overriding identity fields is rare, but restoring a deleted row with its old ID needs it. This post uses IDENTITY_INSERT to put two workshops back with their old numbers. It shows the five errors you will meet, what happens to the next automatic number, and why gaps in an identity column are usually fine.

Read More
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
A hand pulling the rope of a dumbwaiter hatch as a tray of dishes arrives

Loading Data From an API Into SQL Server

July 28, 2011
Pinal Dave
SQL Tips and Tricks
ETL, JSON, PowerShell, SQL Server

Loading data from an API into SQL Server takes paging, JSON staging, retries, and durable checkpoints so a failed request can resume safely.

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
Gouache painting of a cloud above a database beside a winding path

SQL SERVER – Azure Interview Questions and Answers – Guest Post by Paras Doshi – Day 25 of 31

July 25, 2011
Pinal Dave
SQL Interview Questions and Answers
SQL Azure, SQL Server

Paras Doshi’s Azure interview contribution remains part of the 2011 series. Historical answers are clearly separated from current editorial context.

Read More
Previous 1 … 310 311 312 313 314 315 316 … 416 Next
  • Books
  • Testimonials
  • Privacy Policy

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