MS SQL stored proc

Discussion in 'Databases' started by rumblepup, Jul 9, 2006.

  1. #1
    I'm sql stupid, especially when making stored proc's.

    Got a function that captures http referer and request uri into a table

    table columns: uid, http_referer, request_uri

    And I'm trying to write a proc that will parse the http referer for specifics, then place the info into another table.

    I'm trying to track refering search engines, and the keywords

    for example:

    http://www.google.com/search?lr=&ie=UTF-8&oe=UTF-8&q=HTTP_REFERER
    http://search.msn.com/results.aspx?q=HTTP_REFERER&FORM=QBHP
    http://search.yahoo.com/search?p=HT...Search&fr=FP-tab-web-t&toggle=1&cop=&ei=UTF-8

    These would be the strings I capture in column http_referer
    Now I want to write a proc that grabs

    referring search engine
    http://www.google.com

    keywords
    search?lr=&ie=UTF-8&oe=UTF-8&q=HTTP_REFERER

    and INSERT this info into a new table with the columns
    referring search engine, keywords, referred page

    referred page = request_uri

    Any ideas on how to handle this?

    Do I have to right multiple procs for the different search engines, or can I write one big proc with the different search engines in it?
     
    rumblepup, Jul 9, 2006 IP
  2. DanInManchester

    DanInManchester Active Member

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    you don't say what language you are using but I wouldnt use the database o do the parsingas this is out of context.

    Parse the url in your business logic then pass the parameters up into your stored procedure for logging.

    ASP.net has a handy uri class to manage urls
     
    DanInManchester, Jul 11, 2006 IP