473,594 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formatting database content

Hi
I have set up a SQL database to contain alist FAQ's for our company and
then plan to pull this info off using a web page.

So far I have entered the data but I am unable to control how it is
displayed inside SQL ie I cannot enter new blank lines I have tried
using lots of spaces but this does not work when I use the website to
display the info.

Is there a way of formatting and editing the data in the sql database
as I am unable to do this, if I try to edit the data in the database I
have to copy it to notepad delete what is in the database, edit the
text in notepad then paste it back in.

There must be a better way.

Please help

alamb200

May 16 '06 #1
8 1692
Sounds as if you need to convert your carraige return / line feed into the
HTML <BR> tag which will then give you the correct formatting on the screen.

If you want to do it in the database then use REPLACE( <col>, char(13) +
char(10), '<BR>' ) - check, it might be 10, 13 :)

Tony

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
<al******@hotma il.com> wrote in message
news:11******** **************@ j55g2000cwa.goo glegroups.com.. .
Hi
I have set up a SQL database to contain alist FAQ's for our company and
then plan to pull this info off using a web page.

So far I have entered the data but I am unable to control how it is
displayed inside SQL ie I cannot enter new blank lines I have tried
using lots of spaces but this does not work when I use the website to
display the info.

Is there a way of formatting and editing the data in the sql database
as I am unable to do this, if I try to edit the data in the database I
have to copy it to notepad delete what is in the database, edit the
text in notepad then paste it back in.

There must be a better way.

Please help

alamb200

May 16 '06 #2
I have just had a look at the parameter tag but as I am new to SQL I am
not sure how I would put this place.

For example if my prefix charecter was / and my suffix charecter was \
for the sake of argument nad i wanted a new line after the full stop
in the following text how would I enter the information.

If your printer is no longer printing your logo's or overlays it may
have lost the images that have been "Flashed" on to it, to reflash your
printer follow the following instructions. Log on to SB Client and go
into the Company Files section. Next goto Runtime then Maintenance and
System Manager Menu.

Also I seem to be unable to edit text already in the database and have
to delete it and reenter it every time, is there an easier way of doing
that.

Thanks

Anthony
Tony Rogerson wrote:
Sounds as if you need to convert your carraige return / line feed into the
HTML <BR> tag which will then give you the correct formatting on the screen.

If you want to do it in the database then use REPLACE( <col>, char(13) +
char(10), '<BR>' ) - check, it might be 10, 13 :)

Tony

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
<al******@hotma il.com> wrote in message
news:11******** **************@ j55g2000cwa.goo glegroups.com.. .
Hi
I have set up a SQL database to contain alist FAQ's for our company and
then plan to pull this info off using a web page.

So far I have entered the data but I am unable to control how it is
displayed inside SQL ie I cannot enter new blank lines I have tried
using lots of spaces but this does not work when I use the website to
display the info.

Is there a way of formatting and editing the data in the sql database
as I am unable to do this, if I try to edit the data in the database I
have to copy it to notepad delete what is in the database, edit the
text in notepad then paste it back in.

There must be a better way.

Please help

alamb200


May 16 '06 #3
On 16 May 2006 04:13:58 -0700, al******@hotmai l.com wrote:
I have just had a look at the parameter tag but as I am new to SQL I am
not sure how I would put this place.

For example if my prefix charecter was / and my suffix charecter was \
for the sake of argument nad i wanted a new line after the full stop
in the following text how would I enter the information.
Hi Anthony,

wiith the right front-end, there's no need to use parameters. For
instance, copy and paste the following into Query Analyzer and execute;
you'll see that the output has exactly the lline breaks yoou asked for:

CREATE TABLE test (KeyColumn int NOT NULL PRIMARY KEY,
DataColumn varchar(1000) NOT NULL)
INSERT INTO test (KeyColumn, DataColumn)
VALUES (1, 'If your printer is no longer printing your logo''s or
overlays it may have lost the images that have been "Flashed" on to it,
to reflash your printer follow the following instructions.
Log on to SB Client and go into the Company Files section.
Next goto Runtime then Maintenance and System Manager Menu.')
go
SELECT * FROM test
go
DROP TABLE test
go

(Note: beware of extra line breaks inserted by Usenet software. In the
intended code, there are line breaks after the periods, but no other
line breaks in the VALUES clause.)
Also I seem to be unable to edit text already in the database and have
to delete it and reenter it every time, is there an easier way of doing
that.


That, too, is a problem with your frontend.

May I ask you what tool you are using as your frontend?

--
Hugo Kornelis, SQL Server MVP
May 16 '06 #4
Hi

I am using a web page as my front end using ASP to pull the info from
the SQL database so I am in the position of either having multiple
columns with small bits of info in my database so I can format them how
I want

The other option is to have some commands built into the text in the
database entry which will be read by the system and control the
formatting when it is read.

Is this possible?

When I am trying to edit the info in the database all I am doing is
right clicking on the table in Enterprise manager and display all
columns and working on it from there.

Is this the right way to do this?

Anthony
Hugo Kornelis wrote:
On 16 May 2006 04:13:58 -0700, al******@hotmai l.com wrote:
I have just had a look at the parameter tag but as I am new to SQL I am
not sure how I would put this place.

For example if my prefix charecter was / and my suffix charecter was \
for the sake of argument nad i wanted a new line after the full stop
in the following text how would I enter the information.


Hi Anthony,

wiith the right front-end, there's no need to use parameters. For
instance, copy and paste the following into Query Analyzer and execute;
you'll see that the output has exactly the lline breaks yoou asked for:

CREATE TABLE test (KeyColumn int NOT NULL PRIMARY KEY,
DataColumn varchar(1000) NOT NULL)
INSERT INTO test (KeyColumn, DataColumn)
VALUES (1, 'If your printer is no longer printing your logo''s or
overlays it may have lost the images that have been "Flashed" on to it,
to reflash your printer follow the following instructions.
Log on to SB Client and go into the Company Files section.
Next goto Runtime then Maintenance and System Manager Menu.')
go
SELECT * FROM test
go
DROP TABLE test
go

(Note: beware of extra line breaks inserted by Usenet software. In the
intended code, there are line breaks after the periods, but no other
line breaks in the VALUES clause.)
Also I seem to be unable to edit text already in the database and have
to delete it and reenter it every time, is there an easier way of doing
that.


That, too, is a problem with your frontend.

May I ask you what tool you are using as your frontend?

--
Hugo Kornelis, SQL Server MVP


May 17 '06 #5
On 17 May 2006 02:01:41 -0700, al******@hotmai l.com wrote:
Hi

I am using a web page as my front end using ASP to pull the info from
the SQL database so I am in the position of either having multiple
columns with small bits of info in my database so I can format them how
I want

The other option is to have some commands built into the text in the
database entry which will be read by the system and control the
formatting when it is read.

Is this possible?
Hi Anthony,

I'm not an ASP guy, so I don't know. Are you saying that linebreaks in a
long character data column are not displayed properly by ASP? Have you
consiedered asking for alternatives in one of the ASP groups?

When I am trying to edit the info in the database all I am doing is
right clicking on the table in Enterprise manager and display all
columns and working on it from there.

Is this the right way to do this?


No, definitely not. Data entry through Enterprise Manager is broken in
far more ways than I care to remember. Some of these errors are listed
by Aaron Bertrand at http://www.aspfaq.com/show.asp?id=2455.

--
Hugo Kornelis, SQL Server MVP
May 17 '06 #6
Hi

Go to http://212.50.191.220/techfaq and enter restart in the search box
in the bottom center this pops up a new page of info pulled from my SQL
database. As you can see it can be difficult to read so I would like to
add some line breaks and if possible some other formatting.

When I pull the info in it comes as one big lump of text so ASP cannot
format it what I beleive from one of my earlier replies is that I can
embed some commands into the text held in the entry to be pulled out of
the database that ASP can read and turn into html formatting when it is
displayed on the page.

Is this correct and if so how do I add them.

Anthony
Hugo Kornelis wrote:
On 17 May 2006 02:01:41 -0700, al******@hotmai l.com wrote:
Hi

I am using a web page as my front end using ASP to pull the info from
the SQL database so I am in the position of either having multiple
columns with small bits of info in my database so I can format them how
I want

The other option is to have some commands built into the text in the
database entry which will be read by the system and control the
formatting when it is read.

Is this possible?


Hi Anthony,

I'm not an ASP guy, so I don't know. Are you saying that linebreaks in a
long character data column are not displayed properly by ASP? Have you
consiedered asking for alternatives in one of the ASP groups?

When I am trying to edit the info in the database all I am doing is
right clicking on the table in Enterprise manager and display all
columns and working on it from there.

Is this the right way to do this?


No, definitely not. Data entry through Enterprise Manager is broken in
far more ways than I care to remember. Some of these errors are listed
by Aaron Bertrand at http://www.aspfaq.com/show.asp?id=2455.

--
Hugo Kornelis, SQL Server MVP


May 18 '06 #7
On 18 May 2006 06:53:21 -0700, al******@hotmai l.com wrote:
Hi

Go to http://212.50.191.220/techfaq
"The page cannot be found"
When I pull the info in it comes as one big lump of text so ASP cannot
format it


I can only repeat my previous suggestion: if ASP has trouble retaining
embedded CR/LF combinations from a varchar column, then the best place
to seek help is an ASP group.

--
Hugo Kornelis, SQL Server MVP
May 18 '06 #8
(al******@hotma il.com) writes:
When I pull the info in it comes as one big lump of text so ASP cannot
format it what I beleive from one of my earlier replies is that I can
embed some commands into the text held in the entry to be pulled out of
the database that ASP can read and turn into html formatting when it is
displayed on the page.


Neither do I know much ASP, but I would assume that if you get some
text from the database, and spit it out between regular <P> tags,
that any line breaks will be blissfully ignored, as that is how HTML
works.

You could use the <PRE> tag to maintain the line-breaks, but the text
would be presented in a monospaced font, so it may look a bit ugly.

You could run this:

SELECT replace(col, char(13) + char(10), <BR />)

to change line breaks to <BR /> tags. The <BR /> introduces a line break
in the text.

You could also store the text in HTML format.

But as Hugo says, asking in an ASP group is probably a good idea.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
May 19 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3150
by: Matt | last post by:
I have a textarea that is populated from a blob within a database. Everytime the data is pulled, however, there is always a lot of leading space characters before the actual text. It is not in the database this way, so how might I specify more formatting parameters within the textarea? Matt Williams
4
1840
by: Rob Meade | last post by:
Hi all, Ok - this leads on from speaking to a couple here and in the SQL server group... I've an application which allows the user to type in their text into a form, they add 'happy' tags around their words, the app then replaces these with the html equivalent and saves it to the database... Thus far this has been working very well.
1
10174
by: Riko Eksteen | last post by:
Hi I'm reading an xml file into an XmlDocument, adding some nodes, and writing it back out. I would like the nodes I add to assume the same level of indeting as the rest of the document. (I load the document with PreserveWhiteSpace = true.) I thought I could do this by using an XmlTextWriter with Formatting set to Formatting.Indented, but this doesn't work. The Formatting.Indented on the XmlTextWriter only indents my output when I...
7
398
by: ilona | last post by:
Hi all, I store phone numbers in the database as 123447775665554(input mask is used for input, and some numbers have extensions), and I also know from db if the number is Canadian, US, or some other country. When I retrieve the phone numbers, I need to display them as (###) ###-#### x 99999 if it is a Canadian number or (###) ###-#### Ext. 99999 if it is US phone number. Potentially I'd have other countries added as well which might have...
7
4669
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is quite ugly. The black area is larger then it is once an item is added. How can I solve this problem either by: A) Having only the header black and the rest of the empty block white or gray (preffered solution) B) Having the color gray or white...
4
3228
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
0
1146
by: ian | last post by:
Hi, I am having problems formatting a web part zone when then zone appears within a content page. If I add a zone to a normal page, and auto format it then the zone appears as it should, i.e.the title bar is formatted as it looks at design time. However if I create a simple master page, with no content and no themes, and place the same web part zone within a content page, the formatting does not apply - or at least not all of it does...
4
2611
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I re-format the updated row fields. I have looked at gridView.rowUpdated method, but cannot figure out how....
2
1395
by: Rozzy | last post by:
Hi, I'm having trouble using the proper terminology, so bear with me, I am trying to submit text to a mysql database. I want to be able to allow formatting of this content (like breaking it up into paragraphs). I am sending the data to the server via ajax, and so escape the characters. When I read back the information on my news page, all of the formatting is gone. Do I need to unescape the charachters somehow using javascript or php?
0
7947
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7880
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8010
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5413
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.