bmanmike39
asked on
I have a select query that I would like to add string data to
I would like to have my query return the following
SELECT dirID, name, email, http://www.details.aspx?dirID={ + dirID + } AS qs
FROM directors
I get an error when I try this. How can I create this http query string as a result in my query?
Sample of the query Im trying to create
http://www.details.aspx?dirID={0}
SELECT dirID, name, email, http://www.details.aspx?dirID={ + dirID + } AS qs
FROM directors
I get an error when I try this. How can I create this http query string as a result in my query?
Sample of the query Im trying to create
http://www.details.aspx?dirID={0}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just convert the dirID to varchar and then append it to the string.
SELECT dirID, name, email, 'http://www.details.aspx?dirID={' + CAST(dirID AS varchar) + '}' AS qs
FROM directors
SELECT dirID, name, email, 'http://www.details.aspx?dirID={' + CAST(dirID AS varchar) + '}' AS qs
FROM directors
try my post as given
ASKER
Thanks it works , fond a typo first time i ran it.
You need to use single quotation marks in SQL, double ones are meaningless
ASKER
I used single and double quotation marks
SELECT dirID, email, '"http://www.details.aspx?dirID={'" + convert(varchar(max),dirID
FROM directors