Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL > HTML format

Author  Topic 

ranalk
Starting Member

49 Posts

Posted - 2010-02-23 : 02:37:36
Hi,

I would like to transform the following table into HTML page(table format) in order to produce email report:



Could anyone help me understand how to do it ?

Thanking you in advance,
Ran


pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-02-23 : 03:32:30
Hi,

I couldnot see the image (may be there is some issue with browser)

--Just to start with.

I created a sample Emp table and inserted some records
--Sample table
CREATE TABLE [dbo].[Emp](
[Eno] [int] Primary Key,
[Ename] [varchar](50) NULL,
[DOJ] [datetime] NULL DEFAULT (getdate())
)


Declare @SqlValue varchar(max)
Set @SqlValue ='<HTML> <Table border =1 > ' + Char(10)
Select @SqlValue= @SqlValue +'<TR> <TD> ' + Cast(Eno as varchar) + ' </TD> <TD> ' + Ename + '</TD> <TD> ' + Cast(Doj as varchar) + ' </TD> </TR>' + Char(10) from Emp
Set @SqlValue = @SqlValue + '</Table> </HTML>'
Print @SqlValue

The output is in html format.. copy the output to blank file and save it as .htm and check with browser

I am not sure whether this is the right way to get output or there is another way to generate the output in html format.

You can follow this approach if you have to solve something urgently or wait till a sql experts gives valuable suggestion.

Regards,
Bohra
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-02-23 : 03:59:12
There is no <body>-tag!
I would do that in front end.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -