Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
getfar
Starting Member
15 Posts |
Posted - 2006-02-20 : 07:39:06
|
| Hi,i'm Luke and i'have a little problem with SQL SERVER:I want have the output of a simple query in xml.I can have a xml schema from a query with "for xml" but i need a xsl schema.Is it true?How can i have a xsl schema from Sql server?Thanks a lot |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-02-21 : 07:26:35
|
schema is defined by the AUTO, RAW or EXPLICIT option.read about that in Books online = sql server help.Go with the flow & have fun! Else fight the flow |
 |
|
|
my_aro
Yak Posting Veteran
50 Posts |
Posted - 2006-02-22 : 17:02:21
|
| hey bro i guess u can also directly get values by doing this.. i dont know if xsl does it but u can have a try with this example.StudId LastName FirstName----- ---------- ----------- 1 Lim Marc 2 Chung KenYou can create XML from this data using a query like this:select xmlelement ( name "students", xmlattributes (s.StudId as "id"), xmlelement ( name "names", xmlelement ( name "first", s.FirstName), xmlelement ( name "last", s.LastName) ) ) from Students s;as these may give u an XML which looks like this.< students id='1'> <names> <first>Marc</first> <last>Lim</last> </names> </students> <students id='2'> <names> <first>Ken</first> <last>Chung</last> </names> </students>but if object gets complicated u can have XPath for that.. or if u wanted it in java code i can offer u some help too.hope this helps..GodSpeed! |
 |
|
|
|
|
|