Fun with SQL and absolute urls

  • Here's something that makes you scream when you're trying to run a test version and live version of an application which you want to be completely separated from each other:

    SELECT A.AssID, CASE isnull(A.imgFilename ,'')<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

                                                                WHEN '' THEN   '<img src="">'<o:p></o:p>

                                                                ELSE '<img src="' + A.imgFilename + '" height=225>'<o:p></o:p>

                                                    END as [ImageLocation]  <o:p></o:p>

                            FROM   tblWL_Images A


    An absolute link inside a stored procedure!

    The only way to find these links is to do a full-text search over the entire set of stored procedures in the database.

    That still doesn't rule out there being links as text in tables. Therefore you need to do a full-text search over all data in all tables of the database.

    I have decided that this code is the definition of unportabilty.

  • HTML inside a query?





    HTML inside a query?! 

  • Yep. This application is basically 1-tier: The database!

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.