?
Solved

HTML in database query

Posted on 2008-06-20
6
Medium Priority
?
171 Views
Last Modified: 2010-04-21
I am running a simple select statement that outputs records from a clients table returning their ID, First Name and Last Name.

Is there a way to return a link in that table as well, ie, I thought:

select id, alt_id as [Alternate ID], t.first_name as [First Name], t.last_name as [Last Name],
'<a href=https://someurl?id=' & id & '>Link</a>' as Link

would work but it doesn't.
0
Comment
Question by:hyphenpipe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21832174
if the link is stored in a field, you just need to mention that column

select id, alt_id as [Alternate ID], t.first_name as [First Name], t.last_name as [Last Name], Link
from urTable
0
 
LVL 6

Author Comment

by:hyphenpipe
ID: 21832229
The link is not stored in a field.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21832514
You want to return the same link with all the resultset ?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 6

Author Comment

by:hyphenpipe
ID: 21832772
Say I have a table that only contains:

ID, First_Name, Last_Name

I want the output result to be

http://someurl?id=ID where ID is the ID number from the table.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 21832881
you used & , but SQL uses +
select id, alt_id as [Alternate ID], t.first_name as [First Name], t.last_name as [Last Name],
'<a href=https://someurl?id=' + CAST(id as varchar(20)) + '>Link</a>' as Link 

Open in new window

0
 
LVL 6

Author Closing Comment

by:hyphenpipe
ID: 31469205
Thanks!!!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question