How? Assuming that developer always doubles single quotes.
Assume you have a name/address form for the user to enter their contact info. Pretend I'm an evil user, and I enter this into the name field:
[tab]';DROP TABLE tbl_User --
After your application code doubles up the quotes, and stuffs it into your dynamic SQL, it looks like:
[tab]INSERT INTO tbl_User (username, addr, city)
[tab]VALUES (''';DROP TABLE tbl_User -- ',
[tab]'501 Main Street', 'Smallville')
You now have three single-quotes in a row, which evaluate to two single-quotes, meaning an empty string. The semi-colon SQL terminator then kills the INSERT statement. And then it runs the DROP TABLE command. The double dash turns everything after it into a comment to ensure the DROP statement works.
Your Users table is now gone forever. Hope you had a backup.
It gets worse, too. You can run arbitrary commands from the SQL server by running the xp_cmdshell stored procedure. Stuff like the FORMAT command. Or the FTP command, which would allow them to get a copy of any file on your system. Or replace a file on your system with one of their own choosing (Gee, the bad guys just replaced Explorer.exe with their "improved" copy).
This is why parameterizing your queries is so important, and just doubling the quotes up does so little in the way of security.
Chip H.
____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first