By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

Formatting database content

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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******@hotmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.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

P: n/a
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******@hotmail.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.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

P: n/a
On 16 May 2006 04:13:58 -0700, al******@hotmail.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

P: n/a
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******@hotmail.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

P: n/a
On 17 May 2006 02:01:41 -0700, al******@hotmail.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

P: n/a
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******@hotmail.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

P: n/a
On 18 May 2006 06:53:21 -0700, al******@hotmail.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

P: n/a
(al******@hotmail.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****@sommarskog.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 discussion thread is closed

Replies have been disabled for this discussion.