HTML tags inside SQL text

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

Who is Participating?
IncisiveOneConnect With a Mentor Commented:
(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.

mrjoltcolaConnect With a Mentor Commented:
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.
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
sql can't, it treats that value as a varchar / nvarchar ;
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

rbhargawAuthor Commented:
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.
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).


rbhargawAuthor Commented:
lol..isn't soft coding refers to bad programming itself :P
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.

rbhargawAuthor Commented:
Thanks Everyone!
All Courses

From novice to tech pro — start learning today.