Home Authors Posts by Adam Machanic

Adam Machanic

Adam Machanic helps companies get the most out of their SQL Server databases. He creates solid architectural foundations for high performance databases and is author of the award-winning SQL Server monitoring stored procedure, sp_WhoIsActive. Adam has contributed to numerous books on SQL Server development. A long-time Microsoft MVP for SQL Server, he speaks and trains at IT conferences across North America and Europe.

No, stored procedures are NOT bad

I recently found a rather old post from Frans Bouma's blog, "Stored procedures are bad, m'key?".Since comments are closed (he posted it almost a year ago), I have to reply here.I'll state my bottom line at the top: Stored procedures are not only not bad, they're necessary for maintaining loosely coupled, application agnostic, flexible...

Pattern-based replacement UDF

As a personal challenge, I decided to write a UDF that will work just like T-SQL's REPLACE() function, but using patterns as input.The first question: How does REPLACE() handle overlapping patterns?SELECT REPLACE('babab', 'bab', 'c')-------------------------------------------------- cab(1 row(s) affected)SELECT REPLACE('bababab', 'bab', 'c')-------------------------------------------------- cac(1 row(s) affected)It appears that SQL Server parses the input string from left to right, replacing...

Caveats of the TEXT datatype

Someone named "Krygim" posted the following question today in the microsoft.public.sqlserver.programming newsgroup: "Will defaulting a TEXT field to an empty string take up more space than defaulting it to Null when no data is entered into the field. " Before reading any further, I ask that you think for...

Popular Posts