473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to convert a table in database to xml to display as html

hi all i need some help on my project'

i need to get xml string of a table from database to send mail's
am currently using a STORED PROCEDURE but am returning a nvarchar(max) value so the length is limited to 8000 so if it gets longer there is a problem. pls help me on this


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[sendinfo]
@bankid int,
@out NVARCHAR(MAX) output,
@mail varchar(50) output

as
DECLARE @tableHTML varchar(max)
begin

SET @tableHTML =N'<table border="1">' +
N'<tr><th>Credit_card Number</th><th>Name</th>' +
N'<th>Address</th><th>Last pay</th><th>amount_due</th></tr>' +

CAST ( ( SELECT td = [Credit_card Number], ' ',
td = Name, ' ',
td = Address, ' ',
td = [Last pay], ' ',
td = amount_due
FROM [Credit_mamagement_system].[dbo].[Info]where [bankID] = @bankid

FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;

SELECT @mail=[E-mail]
FROM [Credit_mamagement_system].[dbo].[Bank_Infomation]where [BankID]=@bankid
set @out =@tableHTML

END
Aug 10 '07 #1
1 1126
hi all i need some help on my project'

i need to get xml string of a table from database to send mail's
am currently using a STORED PROCEDURE but am returning a nvarchar(max) value so the length is limited to 8000 so if it gets longer there is a problem. pls help me on this


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[sendinfo]
@bankid int,
@out NVARCHAR(MAX) output,
@mail varchar(50) output

as
DECLARE @tableHTML varchar(max)
begin

SET @tableHTML =N'<table border="1">' +
N'<tr><th>Credit_card Number</th><th>Name</th>' +
N'<th>Address</th><th>Last pay</th><th>amount_due</th></tr>' +

CAST ( ( SELECT td = [Credit_card Number], ' ',
td = Name, ' ',
td = Address, ' ',
td = [Last pay], ' ',
td = amount_due
FROM [Credit_mamagement_system].[dbo].[Info]where [bankID] = @bankid

FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;

SELECT @mail=[E-mail]
FROM [Credit_mamagement_system].[dbo].[Bank_Infomation]where [BankID]=@bankid
set @out =@tableHTML

END


Hi,
Are you using SQL SERVER 2000? If it is the case, use text instead of varchar. I think It should solve the problem.

-Jason
Aug 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: kevin bailey | last post by:
this old script was written when register globals was 'on'. now i need to convert it to run on a server with a php 4.3.6 - do i just convert the relevant variables from $posted_variable to...
1
by: Joe Conlin | last post by:
I am truncating data from an SQL database and have a script that populates a cell. The problem that I have is I have HTML tags in my database so if the data gets truncated in the middle of a tag,...
5
by: Carl Gilbert | last post by:
Hi I have some ASP code that I want to run from CD within a VB.NET windows application with a web browser control. However, to get the ASP pages to run without a server is proving quite...
4
by: deko | last post by:
I've heard it's best not to have any formatting specified for Table fields (except perhaps Currency), and instead set the formatting in the Form or Report. But what about Yes/No fields? When I...
3
by: ET | last post by:
I don't know whats the problem, but after I added functions to first verify, then relink linked tables if not found, now I can't convert that database to MDE format. I can split the database, but...
2
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
4
by: McGowan | last post by:
Hi, I'm trying to display data from a mysql database in a HTML table but for some reason my code isn't working. At the moment I have got it to read and display the headers and the first row of the...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.