SQL For XML Query [modified]
-
Hi Guys I need help with writing the following query
The QuerySelect daydesc as description ,Features, adfull, askprice, bedrooms as bedroom,rooms, floorarea as sqm, (pADDRESS1 + ''+ PADDRESS2+ ''+PADDRESS2+ ''+PADDRESS3+ ''+ PADDRESS4) AS ADDRESS ,directions from dbo.PROPERTY as Property where property_id = @id for xml auto,elements
Which Currently returns this
< Property> <description>Space and comfort set the tone of this stylish four bedroomed dormer bungalow on the Moynalty Road just outside the village of Mullagh. Situated just short stroll into Mullagh village and all it's amenities, this proeprty offers a purchaser a spacious family home with open-plan kitchen, dining and living areas. Althrough deceptive from the outside, this property is surprisingly spacious and well-laid out with three bedrooms (one en-suite) and family bathroom on the first floor and a very useful double bedroom with adjacent guest w.c, large sitting room, kitchen/dining, separate living/dining and utility room on the ground floor. Viewing by appointment with the Auctioneers is highly recommended.</description> <features>Deceptively spacious family home Quality cream fitted kitchen Two fine reception rooms Slate-tiled kitchen/dining room Television points in all rooms Just a short stroll or minutes drive from the village of Mullagh Close to local Primary SchoolClose to shops, school, church, hotel, playgroup etc.On bus route to secondary schools</features> <askprice>3.7000000e+005</askprice> <bedroom>4</bedroom> <rooms>Entrance Hall (5.38m x 1.78m)Guest W.C. (2.39m x 1.40m)Bedroom (4.35m x 2.51m)Sitting Room (5.98m x 3.62m)Kitchen/Dining Room (8.22m x 3.68m)Utility Room (2.84m x 2.42m)Dining/Living Room (5.38m x 2.84m)Landing ()Bedroom (5.16m x 2.38m)En-Suite Shower Room (1.92m x 1.87m)Bedroom (4.91m x 2.83m)Bedroom (4.17m x 2.88m)Family Bathroom (3.44m x 2.19m)</rooms> <sqm>166</sqm> <directions>From Kells, travel about 4.5 miles into Moynalty village, taking left at the RC church and travel almost two miles. The property is just outside the village of Mullagh on the right hand side.</directions></Property>
It works as expected However, what I would like to achieve is that within the Feat
-
Hi Guys I need help with writing the following query
The QuerySelect daydesc as description ,Features, adfull, askprice, bedrooms as bedroom,rooms, floorarea as sqm, (pADDRESS1 + ''+ PADDRESS2+ ''+PADDRESS2+ ''+PADDRESS3+ ''+ PADDRESS4) AS ADDRESS ,directions from dbo.PROPERTY as Property where property_id = @id for xml auto,elements
Which Currently returns this
< Property> <description>Space and comfort set the tone of this stylish four bedroomed dormer bungalow on the Moynalty Road just outside the village of Mullagh. Situated just short stroll into Mullagh village and all it's amenities, this proeprty offers a purchaser a spacious family home with open-plan kitchen, dining and living areas. Althrough deceptive from the outside, this property is surprisingly spacious and well-laid out with three bedrooms (one en-suite) and family bathroom on the first floor and a very useful double bedroom with adjacent guest w.c, large sitting room, kitchen/dining, separate living/dining and utility room on the ground floor. Viewing by appointment with the Auctioneers is highly recommended.</description> <features>Deceptively spacious family home Quality cream fitted kitchen Two fine reception rooms Slate-tiled kitchen/dining room Television points in all rooms Just a short stroll or minutes drive from the village of Mullagh Close to local Primary SchoolClose to shops, school, church, hotel, playgroup etc.On bus route to secondary schools</features> <askprice>3.7000000e+005</askprice> <bedroom>4</bedroom> <rooms>Entrance Hall (5.38m x 1.78m)Guest W.C. (2.39m x 1.40m)Bedroom (4.35m x 2.51m)Sitting Room (5.98m x 3.62m)Kitchen/Dining Room (8.22m x 3.68m)Utility Room (2.84m x 2.42m)Dining/Living Room (5.38m x 2.84m)Landing ()Bedroom (5.16m x 2.38m)En-Suite Shower Room (1.92m x 1.87m)Bedroom (4.91m x 2.83m)Bedroom (4.17m x 2.88m)Family Bathroom (3.44m x 2.19m)</rooms> <sqm>166</sqm> <directions>From Kells, travel about 4.5 miles into Moynalty village, taking left at the RC church and travel almost two miles. The property is just outside the village of Mullagh on the right hand side.</directions></Property>
It works as expected However, what I would like to achieve is that within the Feat
Some of the fomatting didn't appear to come through - you may like to modify your post. Either remove the HTML from the post and click the "Ignore HTML tags in this message (good for code snippets)" or ensure that all opening angle brackets are properly defined as <
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos
-
Some of the fomatting didn't appear to come through - you may like to modify your post. Either remove the HTML from the post and click the "Ignore HTML tags in this message (good for code snippets)" or ensure that all opening angle brackets are properly defined as <
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos
I don't understand, The post seems to be ok on my side?
Kind Regards, Gary
My Website || My Blog || My Articles
-
Some of the fomatting didn't appear to come through - you may like to modify your post. Either remove the HTML from the post and click the "Ignore HTML tags in this message (good for code snippets)" or ensure that all opening angle brackets are properly defined as <
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos
Thanks for your time but I managed to find a solution it goes something like this select daydesc as description , cast('' + replace(cast(Features as varchar(max)), char(13)+char(10), '') + '' as xml) AS Features, adfull, askprice, bedrooms as bedroom,rooms, floorarea as sqm, (pADDRESS1 + ''+ PADDRESS2+ ''+PADDRESS2 + ''+PADDRESS3+ ''+ PADDRESS4) AS ADDRESS ,directions from dbo.PROPERTY as Property where property_id = @id for xml auto,elements
Kind Regards, Gary
My Website || My Blog || My Articles
-
I don't understand, The post seems to be ok on my side?
Kind Regards, Gary
My Website || My Blog || My Articles
cykophysh39 wrote:
The post seems to be ok on my side?
There is a set of pre tags with nothing apparently in between.
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos
-
Thanks for your time but I managed to find a solution it goes something like this select daydesc as description , cast('' + replace(cast(Features as varchar(max)), char(13)+char(10), '') + '' as xml) AS Features, adfull, askprice, bedrooms as bedroom,rooms, floorarea as sqm, (pADDRESS1 + ''+ PADDRESS2+ ''+PADDRESS2 + ''+PADDRESS3+ ''+ PADDRESS4) AS ADDRESS ,directions from dbo.PROPERTY as Property where property_id = @id for xml auto,elements
Kind Regards, Gary
My Website || My Blog || My Articles
Fair enough. :-D
Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos