generating a string with values from database table

  • I have the following string.

    http://tgl.test.com/plc/login/confirm.asp?c=1&ftr=0&lvert=12344&r=0&email=test@test.com

    I want to generate the following string with diff values for c,ftr,lvert,r and email from the database.

    I have 10000 records in the database for the above values.

    I want to generate 10000 URLs with the values in the database table.

    How can I do this?

    Thanks in advance.

  • Are those values stored in the database? Are they in one table or multiple tables? Are they stored as strings (varchar/nvarchar/char/nchar datatypes)? Are you building the string in the query, or querying the values and building the string in a higher layer?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • you'd need a lot more details to get a more refined answer, but offhand, this might get you started:

    SELECT

    'http://tgl.test.com/plc/login/confirm.asp?'

    + 'c=' + CONVERT(varchar,ColumnRepresenting_c)

    + '&ftr=' + CONVERT(varchar,ColumnRepresenting_ftr)

    + '&lvert=' + CONVERT(varchar,ColumnRepresenting_lvert)

    + '&r=' + CONVERT(varchar,ColumnRepresenting_r)

    + '&email=' + CONVERT(varchar,ColumnRepresenting_email)

    FROM YourTable

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • All those values are stored in one database table and some of them are integers and some are varchar and I am building this string in a sql query to generate 10000 strings.

    Thanks.

  • Thanks Lowell. It worked great.

Viewing 5 posts - 1 through 4 (of 4 total)

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