Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Select ID,AddressLine1,PostCode,Price,Name from Property
  2.  
  3. <Property>
  4. <ID> 1 <ID>
  5. <Address>
  6. <Line1>10 Downing Street</Line1>
  7. <PostCode>SW11SW</Postcode>
  8. </Address>
  9. <Price> 1,000,000,000 <Price>
  10. <Name> My Next House<Name>
  11. </Property>
  12.  
  13. DECLARE @Property TABLE (ID INT, [AddressLine1] VARCHAR(30), PostCode VARCHAR(7),
  14. Price MONEY, [Name] VARCHAR(20));
  15. INSERT @Property
  16. SELECT 1,'10 Downing Street','SW11SW',1000000000,'My Next House'
  17.  
  18. SELECT ID, AddressLine1 AS 'Address/AddressLine1', PostCode AS 'Address/Postcode',
  19. Price, Name
  20. FROM @Property
  21. FOR XML PATH('Property'), ELEMENTS
  22.  
  23. Select
  24. ID,
  25. AddressLine1 as 'Address/Line1',
  26. PostCode as 'Address/Postcode',
  27. Price,
  28. Name
  29. from Property
  30. for xml path, elements
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement