Monday, March 26, 2012

How to save an HTML doc in SQL 2005

I would like to save an HTML doc in a column of a SQL 2005 database.
However, in order to make it more legible, there are carriage returns
--
</head>
<body lang=EN-US>
--
and all I can get using nvarchar or text is the part before the carriage
return. How can I put the full fledged HTML doc into SQL 2005?
TIA,
PaulWhat do you mean by "all I can get using nvarchar or text is the part before
the carriage return"? Are you referring to the resultset in SSMS? Try
returning it as text.
ML
http://milambda.blogspot.com/|||Thank you.
I did.
I made the column Text, and then tried to past in:
<html>
<head>
</head>
<body>
</body>
</html>
And it only saves <html>.
Thanks again,
Paul
"ML" <ML@.discussions.microsoft.com> wrote in message
news:DBE0C195-F9FF-4D40-949E-3B98A2069EE6@.microsoft.com...
> What do you mean by "all I can get using nvarchar or text is the part
> before
> the carriage return"? Are you referring to the resultset in SSMS? Try
> returning it as text.
>
> ML
> --
> http://milambda.blogspot.com/|||How are you doing this? By pasting values through SSMS? I'd suggest writing
an insert procedure in T-SQL instead.
declare @.html nvarchar(max)
set @.html = N'<html>
<head>
</head>
<body>
</body>
</html>'
insert <table>
(
<column>
)
select @.html as <column>
ML
http://milambda.blogspot.com/|||Yes, I was. What I am trying to do is to have users of a ASP.net 2 website
be able to use an HTML generating program like Dreamweaver or FrontPage, or
MS Word, and then save as HTML, to make up a brief web page, then paste it
from the source of the program, and upload it to Sql Server 2005.
I am also trying to just put the location of the file in the column
(~/CustomerWebPages/SomeWebPageByCustomer.htm), and then resolve the rest in
VB.Net code, but that seems hard too.
Thanks,
Paul
"ML" <ML@.discussions.microsoft.com> wrote in message
news:F61A3EAD-AD56-4522-89CC-16AA2F04898D@.microsoft.com...
> How are you doing this? By pasting values through SSMS? I'd suggest
> writing
> an insert procedure in T-SQL instead.
> declare @.html nvarchar(max)
> set @.html = N'<html>
> <head>
> </head>
> <body>
> </body>
> </html>'
> insert <table>
> (
> <column>
> )
> select @.html as <column>
>
> ML
> --
> http://milambda.blogspot.com/|||On Fri, 17 Mar 2006 10:11:29 -0500, Paul wrote:

>Thank you.
>I did.
>I made the column Text, and then tried to past in:
><html>
><head>
></head>
><body>
></body>
></html>
>And it only saves <html>.
Hi Paul,
How did you verify this? If you look at the output in the grid form,
you'll see only the part up to the first newline.
Switch to "output as text" and re-run the query. Do you still see only
the first part of your text?
Hugo Kornelis, SQL Server MVP|||Hello, and Thanks.
yes, I just see the first line. I pasted:
<html>
<head>
</head>
<body>
</body>
</html>
to a table.
Then I ran a query, and got:
InvitationID AlbumID Message CreateDate
-- -- ----
----
----
---- --
-
1 1 <html> 2006-01-01 00:00:00.000
(1 row(s) affected)
What I decided to do was to just reference the address of the file in my tab
le (something like ~/Directory/Filename.htm). All works fine now. I was ju
st curious about doing it.
Paolo
"Hugo Kornelis" <hugo@.perFact.REMOVETHIS.info.INVALID> wrote in message news:hjim12llsmhnk8
kqos25nubll80dv1h5if@.4ax.com...
> On Fri, 17 Mar 2006 10:11:29 -0500, Paul wrote:
>
>
> Hi Paul,
>
> How did you verify this? If you look at the output in the grid form,
> you'll see only the part up to the first newline.
>
> Switch to "output as text" and re-run the query. Do you still see only
> the first part of your text?
>
> --
> Hugo Kornelis, SQL Server MVP

No comments:

Post a Comment