Home All Groups Group Topic Archive Search About

How to save an HTML doc in SQL 2005

Author
17 Mar 2006 2:45 PM
Paul
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,

Paul

Author
17 Mar 2006 2:56 PM
ML
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/
Author
17 Mar 2006 3:11 PM
Paul
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

Show quote
"ML" <M*@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/
Author
17 Mar 2006 3:19 PM
ML
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/
Author
17 Mar 2006 3:54 PM
Paul
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

Show quote
"ML" <M*@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/
Author
17 Mar 2006 11:48 PM
Hugo Kornelis
On Fri, 17 Mar 2006 10:11:29 -0500, Paul wrote:

Show quote
>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
Author
19 Mar 2006 3:13 PM
Paul
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 table (something like ~/Directory/Filename.htm).  All works fine now.  I was just curious about doing it.



Paolo

-------------------------------------



Show quote
"Hugo Kornelis" <h***@perFact.REMOVETHIS.info.INVALID> wrote in message news:hjim12llsmhnk8kqos25nubll80dv1h5if@4ax.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

AddThis Social Bookmark Button