Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Correct SQL syntax for an expression

Posted on 2008-06-10
2
Medium Priority
?
250 Views
Last Modified: 2010-04-21
I am having difficulty creating an expression as part of an SQL Select query in MS SQL 2000. The expression should generate a URL. I have already done for variables that do not include a number, but now have difficulty.

The question is in the code snippet as follows.
I want to create the following URL:-
<a href="admin/doc.asp?id=Num">Text</a>      
where Num is from an int field varID, and Text is from an nvarchar field. Both from a table tblxyz.
 
The following attempt does not work:-
 '<a href="admin/doc.asp?id=' + STR(dbo.tblxyz.varID) + '''>' + dbo.tblxyz.varTitle + '</a>' AS DocURL
 
Grateful for correct coding! Thanks

Open in new window

0
Comment
Question by:pcardwell
[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
2 Comments
 
LVL 11

Accepted Solution

by:
CMYScott earned 2000 total points
ID: 21756086
have you tried something like..

'<a href="admin/doc.asp?id=' + CAST(dbo.tblxyz.varID AS varchar(20)) + '">' + dbo.tblxyz.varTitle + '</a>' AS DocURL
0
 

Author Closing Comment

by:pcardwell
ID: 31465983
Just tried it and it works perfectly. Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

597 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