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: on a vineyard floor four small wooden grape tubs sit in a two by two block, red and white grapes from two vineyard blocks

CUBE: Include Every Two-Dimensional Subtotal Combination

March 3, 2008
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Reports, SQL Scripts, SQL Server

CUBE requests every grouping combination of its dimensions, including independent subtotals and the grand total. I compare its output population with ROLLUP before choosing it. More subtotal families are useful only when the report needs them.

Read More
SQL SERVER - How to Retrieve TOP and BOTTOM Rows Together using T-SQL

SQL SERVER – How to Retrieve TOP and BOTTOM Rows Together using T-SQL

March 2, 2008
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Function, SQL Joins, SQL Scripts, SQL Server

Need TOP 1 and BOTTOM 1 in one result? UNION fails with two ORDER BY clauses. Here is a simple T-SQL way to retrieve TOP and BOTTOM Rows together.

Read More
SQL SERVER - Transfer The Logins and The Passwords Between Instances of SQL Server 2005

SQL SERVER – Transfer The Logins and The Passwords Between Instances of SQL Server 2005

March 1, 2008
Pinal Dave
SQL Tips and Tricks
SQL Download, SQL Scripts, SQL Server Security, SQL Utility

How do you transfer the logins and passwords between instances of SQL Server 2005 after a hardware upgrade? I summarize Microsoft KB 918992 and its script.

Read More
Gouache painting: seen from above, a round cake turntable holds a plain unfrosted cake

SIN and COS: Use Radians for Trigonometric Inputs

February 29, 2008
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

SIN and COS read angles in radians and return float. These explicit degree conversions show signs, axis angles and fractional results at a chosen decimal display scale.

Read More
SQL SERVER - Dynamic Case Statement - FIX : ERROR 156 : Incorrect syntax near the keyword

SQL SERVER – Dynamic Case Statement – FIX : ERROR 156 : Incorrect syntax near the keyword

February 28, 2008
Pinal Dave
SQL Performance
SQL Error Messages, SQL Scripts

Using CASE in ORDER BY to switch between ASC and DESC gives Error 156: Incorrect syntax near the keyword. I show two ways to write a dynamic case that works.

Read More
SQL SERVER - SELECT 1 vs SELECT * - An Interesting Observation

SQL SERVER – SELECT 1 vs SELECT * – An Interesting Observation

February 26, 2008
Pinal Dave
SQL Performance
SQL Scripts, SQL Server

SELECT 1 vs SELECT * inside IF EXISTS: I ran 4 tests and both gave the same result and the same execution plan cost. Can you find a case where they differ?

Read More
A leaf stencil taped to a plaster wall beside three identical painted sage leaves, a paint sponge on a saucer.

Templates and Snippets in SSMS

February 25, 2008
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Scripts, SQL Server Management Studio, SQL Shortcut

Templates and snippets in SSMS turn repeated SQL patterns into editable starting points while keeping environment assumptions visible.

Read More
Previous 1 … 320 321 322 323 324 325 326 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

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