hyperlink in select statement

  • I have a developer that is creating an SQL query and wants to generate a hyperlink in the SQL itself such as

    select name, http:// + document + '.pdf' from table 1

    (something like that)

    my question is, is it recommended to add links in the SQL itself like this or no? I'm pushing for him to just get the data from the query and do the hyperlink on the front of the web page, not in the SQL itself.

  • yes, it is possible to generate a string that when displayed is a hyperlink.

  • I see nothing wrong with that method.

    Some databases also store url in the database.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • the URL isn't being stored, its just a string that is being pulled out of the table and then wrapping a link around it

  • I don't think there is a "right" or "wrong" answer here. There are benefits to both sides. The biggest benefit to doing this in the front end (since the URL is not in the database) is that if this changes it is less effort to change the front end. Since the developer is likely to be the first one called, they could then just update their config file instead of changing some hard coded string in a proc. And of course the benefit to the developer is letting sql do the work for them.

    /flip coin

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • SQL_NuB (4/11/2012)


    the URL isn't being stored, its just a string that is being pulled out of the table and then wrapping a link around it

    Understood. I was just saying that storing the URL is also an option.

    This really is just a coin flip as to how the URL is produced.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply