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 hand holding a bunch of grass stems by a campfire, one short stem with a red tip just drawn out

Picking Random Winners Fairly With NEWID and CRYPT_GEN_RANDOM

December 14, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Random, SQL Server, SQL Transactions

Pick random winners with NEWID or cryptographic randomness, handle weights and unique entrants, and save a draw with its seed and timestamp.

Read More
A row of wooden toy animals with the repeats set aside in a basket below.

Removing Repeated Characters From a String With GENERATE_SERIES

December 8, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL Server 2022, SQL String

Remove repeated characters with GENERATE_SERIES, ROW_NUMBER, and ordered STRING_AGG, then benchmark a SQL Server 2019 fallback.

Read More
Hands sewing cloth bunting whose cord has run out, two red flags side by side.

STRING_AGG Limits: The 8,000 Byte Error, Ordering and Duplicates

December 1, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL String, SQL XML

Fix STRING_AGG 8,000-byte limits, enforce ordering, remove duplicates before aggregation, and compare its timing with XML.

Read More
A child's hand printing the same red leaf shape in a row on brown paper with one carved potato stamp.

The WINDOW Clause: Name a Window Once and Reuse It

November 29, 2012
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL Function, SQL Server, SQL Server 2022

Use the WINDOW clause to reuse partition and order rules, extend named windows with frames, and keep SQL Server calculations consistent.

Read More
SQL SERVER - Find Weekend and Weekdays from Datetime in SQL Server 2012

SQL SERVER – Find Weekend and Weekdays from Datetime in SQL Server 2012

November 25, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server, SQL Server 2012

Is today a weekend or a weekday? A question from the very first SQL Bangalore User Group meeting, answered with the CHOOSE function in SQL Server 2012.

Read More
SQL SERVER - Removing Leading Zeros From Column in Table - Part 2

SQL SERVER – Removing Leading Zeros From Column in Table – Part 2

November 22, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function

Part 2 on removing leading zeros from column values: readers improved my sample with all-zero values and shared better methods, collected here.

Read More
SQL SERVER - Using RAND() in User Defined Functions (UDF)

SQL SERVER – Using RAND() in User Defined Functions (UDF)

November 20, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

Using RAND() in a user defined function throws Msg 443, invalid use of a side-effecting operator. Here is a simple workaround that lets a UDF use a random value.

Read More
Previous 1 … 29 30 31 32 33 34 35 … 61 Next
  • Books
  • Testimonials
  • Privacy Policy

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