November 26, 2008 at 9:33 am
I was asked to peek into a simple web project, which they were upgrading to avoid sql injection attacks.
I was happy to hear they switched to using stored procedures and adding a parameters to avoid SQL Injections, until I saw this procedure; figured some of you might like a laugh before the holidays.
[font="Courier New"]
CREATE PROCEDURE pr_Search @text VARCHAR(1000)
AS
BEGIN
DECLARE @sql VARCHAR(MAX)
SET @sql = 'SELECT * FROM VW_TERMS WHERE TERM=@text ORDER BY TERMID'
SET @sql = REPLACE(@sql,'@text',@text)
EXEC(@sql)
END[/font]
Lowell
November 26, 2008 at 9:36 am
November 26, 2008 at 9:54 am
<Sigh>
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 26, 2008 at 11:15 am
Sweet!
I'll bet it makes programming easy.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 26, 2008 at 11:29 am
Heh. Well, the good news is: that one looks easy to fix. 🙂
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply