Showing posts with label multiple. Show all posts
Showing posts with label multiple. Show all posts

Wednesday, March 28, 2012

How to remove page breaks when you have multiple groups

Hi,
When you have more than one sub groups in a report, table keeptogether is not
functioning properly. It is always breaking into multiple pages.
I would appreciate if anybody give a fix for this problelm
Thanks,
vamsi.This problem has been a major irritant for me. Suggestions for a workaround
gratefully appreciated!

Friday, March 9, 2012

how to read multiple records in a xml file using openxml

I have a xml like:

<Member ID="123">
<DateBorrowed>11-01-2006</DateBorrowed>
<Book ID="222"
Title=""ABC">
<Category> Fiction</Category>
</Book>
<Book ID="333"
Title=""ABu">
<Category>Children</Category>
</Book>
......
</Member>

I used OPENXML to read into MS SQL server database table, but it only reads first book. What should I do to read all three books, and insert 2 lines into the table:

MemberID | DateBorrowed | BookID | BookTitle | BookCategory
123 11-01-2006 222 ABC Fiction
123 11-01-2006 333 ABu Children
......

My code following only read first book:

CREATE PROCEDURE sp_insert_RefundCorrectionAcceptance AS

DECLARE @.iTree int
DECLARE @.xmlFile VARCHAR(2000)

EXEC sp_xml_preparedocument @.iTree OUTPUT, @.xmlFile,
SELECT *
FROM OPENXML (@.iTree,'root', 3)
WITH (
MemberID decimal '/Member/@.ID',
DateBorrowed datetime 'DateBorrowed/text()',
BookID decimal '/book/@.id',
bookTitle varchar(200) '/book/@.title',
bookCat varchar(100) '/book/category/text()'

)
EXEC sp_xml_removedocument @.iTree
GO

Thanks

I hop it will work for you.........

Code Snippet

DECLARE @.iTree int

DECLARE @.xmlFile VARCHAR(2000)

set @.xmlFile='

<Member ID="123">

<DateBorrowed>11-01-2006</DateBorrowed>

<Book ID="222" Title="ABC">

<Category> Fiction</Category>

</Book>

<Book ID="333" Title="ABu">

<Category>Children</Category>

</Book>

<Book ID="334" Title="XYZ">

<Category>XYZ</Category>

</Book>

</Member>

'

EXEC sp_xml_preparedocument @.iTree OUTPUT, @.xmlFile

SELECT * FROM OPENXML (@.iTree,'/Member/Book/Category',2)

WITH (

MemberID decimal 'http://@.ID',

DateBorrowed datetime 'http://DateBorrowed/text()',

BookID decimal '../@.ID',

bookTitle varchar(200) '../@.Title',

bookCat varchar(100) 'text()'

)

EXEC sp_xml_removedocument @.iTree

GO

Happy Programming Dear...

How to read in multiple SELECT statements of different return types in T-SQL

HI,
I understand how to use NextResultset() in ADO.NET to return multiple
readers from a stored proc. What if a SELECT returns a scalar and
another returns rows.
Thank you!> What if a SELECT returns a scalar and
> another returns rows.
Let me rephrase above:
"What is a SELECT returns a scalar and another returns a table"
Actually all SELECT statements returns tables (with some obscure exceptions like COMPUTE). So, a
scalar is just a table that happens to have only one column and one row. I.e., you treat is as a
table. The ExecuteScalar method is just something that ADO.NET designers cooked up to make it easier
for us to get the value from a select statement that returns a table with one column and one row.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<webdevaccount@.gmail.com> wrote in message
news:1182811103.414233.319970@.m36g2000hse.googlegroups.com...
> HI,
> I understand how to use NextResultset() in ADO.NET to return multiple
> readers from a stored proc. What if a SELECT returns a scalar and
> another returns rows.
> Thank you!
>