IT Community - Software Programming, Web Development and Technical Support

how to create stored procedure for view to generate xml?

This is a discussion on how to create stored procedure for view to generate xml? within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi, How to create stored procedure to generate xml for view not for table?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-07-2008, 10:20 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile how to create stored procedure for view to generate xml?

Hi,
How to create stored procedure to generate xml for view not for table?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-14-2008, 08:37 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: how to create stored procedure for view to generate xml?

View and table differs in only not affecting the data....so u can create SP / Query to retrieve the data in XML
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-14-2008, 09:16 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: how to create stored procedure for view to generate xml?

Hi,
See the following query.I want to retrieve data from more than one table.

Select distinct Owner.Name,employee.Id,employee.Name from Owner,employee where Owner.Name=employee.OwnerName and employee.Id=Owner.employeeId for xml auto,root('xml')

This can generate XML and successfully executed.

But if u use the same query while creating view at that time itself it shows error as 'unable to parse the text' and View is not created in SqlServer.Could u tell me the way to use this query to create view
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-25-2008, 12:21 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: how to create stored procedure for view to generate xml?

Hi,
I found the solution for this.

Through SqlServer we can create stored Procedure and include that in asp.net by using existing stored Procedure.

If u want the set the node of ur own then the following should be used,

CREATE procedure [dbo].[GetTestMenu]
as SELECT 1 as Tag,
0 as Parent,
MenuName as [MenuMapping!1!MenuName],
NULL as [Category!2!Id],
NULL as [Category!2!Name]

FROM MenuMapping
UNION
SELECT
2 as tag,
1 as parent,
MenuName,
Id,
[Name]from Category for xml explicit,root('menu')
RETURN

Here the xml will be in the following format,
<menu>
<MenuMapping MenuName="Book"/>
<MenuMapping MenuName="CSE"/>
<MenuMapping MenuName="EEE">
<Category Id="21" Name="ControlSystem"/>
<Category Id ="22" Name="Architecture"/>
</MenuMapping>
</menu>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/5198-how-create-stored-procedure-view-generate-xml.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 02-14-2008 10:43 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure itbarota Database Support 3 03-10-2008 09:43 PM
Code-behind to create node dynamically using XML File or any Stored Procedure poornima ASP and ASP.NET Programming 3 02-14-2008 09:46 PM
Stored procedure gets executed twice chris ASP and ASP.NET Programming 4 11-01-2007 03:08 AM
Is it possible to create Stored Procedure in Dataset Using Distinct Key ? KiruthikaSambandam ASP and ASP.NET Programming 1 08-08-2007 08:03 AM
Can a stored procedure call itself or recursive stored procedure? How many level SP n H2o Database Support 1 08-03-2007 10:55 AM


All times are GMT -7. The time now is 07:27 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0