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
SQL SERVER - Generate A Single Random Number for Range of Rows of Any Table - Very interesting Question from Reader

SQL SERVER – Generate A Single Random Number for Range of Rows of Any Table – Very interesting Question from Reader

January 28, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Random, SQL Scripts

A reader asked how to get a single random number for a set of rows, like one per PostalCode. I compare NEWID() for each row with RAND() for a whole set.

Read More
ALTER FUNCTION UDF.

SQL SERVER – Remove Duplicate Entry from Comma Delimited String – UDF

January 15, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL String

A simple UDF from reader Ashish Jain that removes duplicate entries from a comma delimited string by turning it into a table and using DISTINCT.

Read More
SQL Server performance query results.

SQL SERVER – Find Number of Rows and Disk Space Reserved – Using sp_spaceused Interesting Observation

January 14, 2009
Pinal Dave
SQL Tips and Tricks
SQL Data Storage, SQL Function, SQL Scripts, SQL Server DBCC, SQL Stored Procedure, SQL Utility

sp_spaceused shows the row count of a table and the disk space reserved. Here is why its numbers looked wrong on AdventureWorks and how @updateusage fixed them.

Read More
A full molasses ladle hangs beside an empty ladle and a bare hook.

Percent Change Between Rows: Handling Zero and NULL Safely

December 13, 2008
Pinal Dave
SQL Tips and Tricks
Best Practices, Mathematical Function, SQL Function, SQL NULL

One zero month can kill a revenue report. Here is how to get percent change without errors or lies.

Read More
Two rows of even stitches and one plain thread line on cream fabric under a sewing machine.

TIMEFROMPARTS: Fraction Values Follow the Precision

December 4, 2008
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

TIMEFROMPARTS builds a time from separate components. The same fractions argument means milliseconds at precision three and much smaller units at precision seven.

Read More
A vineyard row with a sloping wire between two posts, a red bead high on the right and a blue bead low on the left.

ATAN: Understand the Principal Angle of a Ratio

December 1, 2008
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

ATAN converts a tangent ratio into a principal angle. The sign and selected interval matter, and a ratio alone cannot recover every original directional quadrant.

Read More
Four unequal woven cloth strips form one continuous sequence across an oak bench in a sunlit stone workshop.

Running Start Times: Build an Agenda With SQL

November 25, 2008
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Order By, SQL Scripts

Running start times depend on the durations that precede each activity. Use ordered window sums while retaining full dates and explicit end boundaries.

Read More
Previous 1 … 61 62 63 64 65 66 67 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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