Click here to Skip to main content
15,918,742 members
Home / Discussions / Database
   

Database

 
GeneralRe: Installing a SQL Server Management studio Pin
Henry Minute7-Apr-09 0:46
Henry Minute7-Apr-09 0:46 
QuestionHow to make a new server in sql server express 2005??? Pin
ma.amer26-Mar-09 1:45
ma.amer26-Mar-09 1:45 
AnswerRe: How to make a new server in sql server express 2005??? Pin
Eddy Vluggen26-Mar-09 2:17
professionalEddy Vluggen26-Mar-09 2:17 
GeneralRe: How to make a new server in sql server express 2005??? Pin
ma.amer26-Mar-09 3:23
ma.amer26-Mar-09 3:23 
AnswerRe: How to make a new server in sql server express 2005??? Pin
Eddy Vluggen26-Mar-09 3:33
professionalEddy Vluggen26-Mar-09 3:33 
GeneralRe: How to make a new server in sql server express 2005??? Pin
ma.amer26-Mar-09 6:48
ma.amer26-Mar-09 6:48 
GeneralRe: How to make a new server in sql server express 2005??? Pin
Eddy Vluggen26-Mar-09 8:04
professionalEddy Vluggen26-Mar-09 8:04 
QuestionHelp with some XML SQL Statements [modified] Pin
Vimalsoft(Pty) Ltd25-Mar-09 23:21
professionalVimalsoft(Pty) Ltd25-Mar-09 23:21 
Good Morning All

i have the Following sql statement


DECLARE @idoc int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @TagXml

SELECT *
into [#Tag]
FROM  OPENXML (@idoc, '/Tag',2)	-- be very careful this is case sensitive
WITH ( ID int, Descr varchar(128), TypeID int, Note varchar(256), Static varchar(7), objID int )

-- get the list of ids from the edge table
SELECT convert(int, convert(varchar(10), [Text]) ) AS [ID]
into [#ObjList]
FROM  OPENXML (@idoc, '/Tag/objID',2)	-- be very careful this is case sensitive
WHERE [Text] is not null


Now from the above statements i understand this

DECLARE @idoc int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @TagXml 


and the Problem comes here
-- get the list of ids from the edge table
SELECT convert(int, convert(varchar(10), [Text]) ) AS [ID]
into [#ObjList]
FROM  OPENXML (@idoc, '/Tag/objID',2)	-- be very careful this is case sensitive
WHERE [Text] is not null</pre>


I see that they convert varchar to int and call that ID , its cool i understand that and save it in a temp table. Now the unknown part is the part where

FROM  OPENXML (@idoc, '/Tag/objID',2)	-- be very careful this is case sensitive
WHERE [Text] is not null&lt;/pre&gt;</pre>


I understand what their doing, my Problem is that "2" why are they doing there. here is the Input example of the xml

'<Tag>  <ID>0</ID>  <Descr>new_taggy</Descr>  <TypeID>1</TypeID>  <Note />  <Static>true</Static></Tag>'


And MSDN Says

2 Use the element-centric mapping.
Can be combined with XML_ATTRIBUTES; in which case, attribute-centric mapping is applied first, and then element-centric mapping is applied for all columns not yet dealt with. 


Can you please explain for me.

Thank you

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za

modified on Thursday, March 26, 2009 5:32 AM

QuestionLoad XML file in the sql server 2005 table...... Pin
pranavcool25-Mar-09 18:38
pranavcool25-Mar-09 18:38 
AnswerRe: Load XML file in the sql server 2005 table...... Pin
Mycroft Holmes25-Mar-09 21:41
professionalMycroft Holmes25-Mar-09 21:41 
AnswerRe: Load XML file in the sql server 2005 table...... Pin
Vimalsoft(Pty) Ltd25-Mar-09 23:27
professionalVimalsoft(Pty) Ltd25-Mar-09 23:27 
QuestionCouple questions migrating to MySQL Pin
devvvy25-Mar-09 15:34
devvvy25-Mar-09 15:34 
AnswerRe: Couple questions migrating to MySQL Pin
sunilsb25-Mar-09 20:54
sunilsb25-Mar-09 20:54 
GeneralRe: Couple questions migrating to MySQL Pin
devvvy25-Mar-09 21:58
devvvy25-Mar-09 21:58 
QuestionBest method to complete task of syncing \replicating data Options Pin
Hulicat25-Mar-09 13:19
Hulicat25-Mar-09 13:19 
QuestionOracle vs SQL server Pin
E_Gold25-Mar-09 9:56
E_Gold25-Mar-09 9:56 
AnswerRe: Oracle vs SQL server Pin
Eddy Vluggen25-Mar-09 12:00
professionalEddy Vluggen25-Mar-09 12:00 
GeneralRe: Oracle vs SQL server Pin
Luc Pattyn25-Mar-09 14:08
sitebuilderLuc Pattyn25-Mar-09 14:08 
GeneralRe: Oracle vs SQL server Pin
Eddy Vluggen25-Mar-09 21:47
professionalEddy Vluggen25-Mar-09 21:47 
GeneralRe: Oracle vs SQL server Pin
E_Gold25-Mar-09 19:14
E_Gold25-Mar-09 19:14 
GeneralRe: Oracle vs SQL server Pin
Eddy Vluggen25-Mar-09 21:53
professionalEddy Vluggen25-Mar-09 21:53 
QuestionHow to preserve databinding in a ToolStripDropDown? Pin
SSDiver211225-Mar-09 9:44
SSDiver211225-Mar-09 9:44 
QuestionHow to Upgrade Access databse to MSSQL2005? Pin
Sr...Frank25-Mar-09 1:14
Sr...Frank25-Mar-09 1:14 
AnswerRe: How to Upgrade Access databse to MSSQL2005? Pin
Eddy Vluggen25-Mar-09 5:26
professionalEddy Vluggen25-Mar-09 5:26 
QuestionExtremely slow SP execution in Asp.net Pin
totig25-Mar-09 0:47
totig25-Mar-09 0:47 

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.