Click here to Skip to main content
15,886,873 members
Home / Discussions / Database
   

Database

 
QuestionCreate Table in Oracle 10G Pin
E_Gold11-Mar-09 2:47
E_Gold11-Mar-09 2:47 
AnswerRe: Create Table in Oracle 10G Pin
Blue_Boy11-Mar-09 2:57
Blue_Boy11-Mar-09 2:57 
GeneralRe: Create Table in Oracle 10G Pin
E_Gold11-Mar-09 5:36
E_Gold11-Mar-09 5:36 
QuestionGenerate Reference Number Pin
musefan11-Mar-09 0:06
musefan11-Mar-09 0:06 
AnswerRe: Generate Reference Number Pin
Blue_Boy11-Mar-09 2:18
Blue_Boy11-Mar-09 2:18 
GeneralRe: Generate Reference Number Pin
musefan11-Mar-09 2:29
musefan11-Mar-09 2:29 
GeneralRe: Generate Reference Number Pin
Blue_Boy11-Mar-09 2:55
Blue_Boy11-Mar-09 2:55 
QuestionT-SQL and XML question. Pin
Jamie Nordmeyer10-Mar-09 17:11
Jamie Nordmeyer10-Mar-09 17:11 
A website I'm writing uses jQuery and a plugin called Flexigrid, that expects an XML document in this format:
<rows>
   <page>1</page>
   <total>7</total>
   <row id="1">
      <cell>1</cell>
      <cell>SomeName</cell>
      <cell>SomeDescription</cell>
   </row>
   <row id="2">
      <cell>2</cell>
      <cell>SomeName</cell>
      <cell>SomeDescription</cell>
   </row>
</rows>


I managed to make it work with the following SQL:

Select
	1 As 'page'
	,7 As 'total'
	,(
		Select
			ID As '@id'
			,(Select ID As 'cell' From Table Where ID = dc.ID For Xml Path(''), Type)
			,(Select [Name] As 'cell' From Table Where ID = dc.ID For Xml Path(''), Type)
			,(Select [Description] As 'cell' From Table Where ID = dc.ID For Xml Path(''), Type, Elements XsiNil)
		From
			Table dc
		For Xml Path('row'), Type
	)
For Xml Path('rows'), Type


Is there a better way to do this? I've scoured Google, and wasn't able to find anything. This works, but it seems like there must be a better way that I'm just not finding.

Thanks.

Jamie Nordmeyer
Portland, Oregon, USA

http://www.feralcodemonkies.com

QuestionRandom or sequential allocation! Pin
Learner52010-Mar-09 14:06
Learner52010-Mar-09 14:06 
AnswerRe: Random or sequential allocation! Pin
Ashfield10-Mar-09 22:04
Ashfield10-Mar-09 22:04 
QuestionRandom or sequential allocation Pin
Learner52010-Mar-09 6:52
Learner52010-Mar-09 6:52 
AnswerRe: Random or sequential allocation Pin
Blue_Boy10-Mar-09 13:32
Blue_Boy10-Mar-09 13:32 
Question@@Identity and triggers Pin
Distind10-Mar-09 3:51
Distind10-Mar-09 3:51 
AnswerRe: @@Identity and triggers Pin
Mycroft Holmes10-Mar-09 16:35
professionalMycroft Holmes10-Mar-09 16:35 
QuestionCannot connect to SQL express database on XP Home edition under a new admin login Pin
Shrikant Gujar9-Mar-09 23:11
Shrikant Gujar9-Mar-09 23:11 
QuestionComposite Primary Key Pin
Jay Royall9-Mar-09 22:02
Jay Royall9-Mar-09 22:02 
AnswerRe: Composite Primary Key Pin
Rob Philpott9-Mar-09 23:21
Rob Philpott9-Mar-09 23:21 
GeneralRe: Composite Primary Key Pin
Jay Royall9-Mar-09 23:36
Jay Royall9-Mar-09 23:36 
AnswerRe: Composite Primary Key Pin
Curtis Schlak.10-Mar-09 13:29
Curtis Schlak.10-Mar-09 13:29 
AnswerRe: Composite Primary Key Pin
Mycroft Holmes10-Mar-09 16:43
professionalMycroft Holmes10-Mar-09 16:43 
Questionhow to generate ID field with auto numbering Pin
sharp_k9-Mar-09 12:44
sharp_k9-Mar-09 12:44 
AnswerRe: how to generate ID field with auto numbering Pin
Luc Pattyn9-Mar-09 13:15
sitebuilderLuc Pattyn9-Mar-09 13:15 
AnswerRe: how to generate ID field with auto numbering Pin
Reza Raad9-Mar-09 18:20
Reza Raad9-Mar-09 18:20 
QuestionDB2 - SQL where selects field that contains @ Pin
Kschuler9-Mar-09 6:43
Kschuler9-Mar-09 6:43 
Answer2 Pin
Luc Pattyn9-Mar-09 7:11
sitebuilderLuc Pattyn9-Mar-09 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.