Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTML tags inside SQL text

Posted on 2009-07-07
8
Medium Priority
?
650 Views
Last Modified: 2012-05-07
Can SQL text handle html tags?

What I mean is that I use html tags on SQL Text with the idea of
formatting the outgoing text. For example, see the code

I want to make "Mail option" as BOLD

If I use <B>Mail option</B>, smthng on this line? Can it be done?

SELECT @text= "If you just initiated a partnership with us, please complete the  form and return it along with requested documents to the address or fax number listed below.
 
Mail Option:
------------
 
 
Fax Option:
-----------
 
"

Open in new window

0
Comment
Question by:rbhargaw
[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
8 Comments
 
LVL 40

Assisted Solution

by:mrjoltcola
mrjoltcola earned 400 total points
ID: 24798664
Sure. It is best if you use bind variables, so there is no need for escaping special characters like quotes, but otherwise, yes it works fine.

If you are asking if SQL itself cares about HTML, no, it won't make it bold in your output, it just treats it as literal text.
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 400 total points
ID: 24798666
sql can't, it treats that value as a varchar / nvarchar ;
0
 
LVL 6

Accepted Solution

by:
IncisiveOne earned 1200 total points
ID: 24800781
(Sybase Only.)

The problem is that you think @text is a text variable, it isn't, there is no such thing (text, image and unitext are invalid for parameters and local variables).

You can place text/image in a column, and retrieve it.  That requires a programming language that uses the text/image operation of CT-Library; these program will bind the column directly to an internal (not external, such as SQL) memory location or variable.  SQL has no text operations, other than interrogating text/image pointers.  The stored text may well have embedded HTML tags or XML tags, indeed, it can be entire HTML or XML documents or images.  Again, all that is dependent on how the calling program handles it.  SQL is a database manipulation language, and has no HTML or XML capabilities.

the question is, where (what program, at what point) do you want to make some string of characters bold; ie. where do you want the transposition of tags to take place.  That should help you to decide where you place/store the tags.  Whether the character or text data you store in Sybase contains such tags is not relevant.

Cheers
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:rbhargaw
ID: 24807632
We have an mail application(VC++)  which uses outlook to send the email and attaches the text on the body of email.. That application call the stored procedure.The text  is hardcoded in Stored procedure. So based on above answers , I think I need to do may be a application level.
0
 
LVL 6

Expert Comment

by:IncisiveOne
ID: 24810025
Yes.  That would be the easiest place and the most appropriate, since that is what hosts the interface between Outkook and the SQL database; that is what determines or providesmeaning to the content of the email (boody or headers).

Just to clarify:
1  since the sp if software, it is soft coded, not hard coded.
2  if you understand my post above, the sp does not manipulate the text column in the database; you will find that in the app.  The sp probably (and quite correctly) sets things up (such as insert/update/delete/get text pointer).

Cheers

0
 

Author Comment

by:rbhargaw
ID: 24810305
lol..isn't soft coding refers to bad programming itself :P
0
 
LVL 6

Expert Comment

by:IncisiveOne
ID: 24814314
If you have a program eg. to count the bytes in a file, and the program set the filename to something fixed, inside the program, it could only be changed by changing the program.  The user would have to change the name of the file to be read, to the fixed filename.  That's a hardcoded filename.  A qualified programmer would have the user pass the filename to be read as a parameter.

There is no term "softcoded", I was being a little bit tongue-in-cheek, and the term is easily understood in contrast to the established term, hardcoded.  All software is "soft", it is poor programming to hardcode anything that changes, such as an input filename.

When you said "the text is hardcoded", if you were referring to the text " If you just initiated a partnership with us... ", then no, that is not hardcoded.  It is a reasonable thing to place in a fixed string in the sp, and is not likely to change; it would be unreasonable to have that "softcoded" and passed every time, or read in from a table, etc.  And sps are very easy to change.

Cheers
0
 

Author Closing Comment

by:rbhargaw
ID: 31600836
Thanks Everyone!
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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

730 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