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 pepper mill holds peppercorns above its mechanism with an unsuitable pebble caught before grinding

Second-Order SQL Injection: When Stored Data Becomes Code

May 30, 2012
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Server Security, SQL String, SQL Variable

A safe insert does not make the saved value safe forever. Here is how stored text turns into code later, and the plain fix.

Read More
A pastry crimper seals a pie edge through its fixed toothed shape beside unused decorative cutters

Dynamic ORDER BY Without Injection: Whitelisting Sort Columns

May 9, 2012
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Order By, SQL Server Security, SQL Variable

Parameters cannot name a column, so grids end up gluing text into SQL. Here is the approved-list pattern that keeps the sort safe.

Read More
A full spice rack with no room left, a new jar of red paprika standing on the counter below

Dynamic PIVOT: Building Report Columns From the Data

May 17, 2009
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, PIVOT and UNPIVOT, SQL Reports, SQL Server

Build a dynamic PIVOT with ordered STRING_AGG and QUOTENAME, parameterized filters, zero-filled results, and explicit report-width limits.

Read More
A hand pours red liquid into a copper jelly mold beside two finished jellies of different colors and the same shape.

Parameterized Queries From Application Code

June 29, 2008
Pinal Dave
SQL Tips and Tricks
Best Practices, Developer, Dynamic SQL, SQL Server, SQL Server Security

Use parameterized queries from application code to prevent SQL injection, improve plan reuse, and avoid parameter length mistakes.

Read More
A fingertip presses into a gap in an old stone wall where crumbled mortar lets a green shoot push through.

Finding Dynamic SQL Open to Injection

June 24, 2008
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Server, SQL Server Security, SQL Stored Procedure

Find dynamic SQL open to injection by searching module definitions for concatenation, then replace data concatenation with parameters.

Read More
A plumber pressure-tests a new copper pipe with a hand pump as a single bead of water forms at one joint.

Testing an Application for SQL Injection

May 21, 2007
Pinal Dave
SQL Tips and Tricks
Developer, Dynamic SQL, SQL Server Security, Testing

Testing an application for SQL injection on a safe copy reveals response clues and unsafe query construction before repair.

Read More
Previous 1 2 3
  • Books
  • Testimonials
  • Privacy Policy

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