Wednesday, March 28, 2012
Newbie Question about parameters
i'm using HTTP to get XML from SQLserver 2000. I need to query the database with parameters. most of them are arrays.
i am however unable to get any data from my database using
WHERE name IN (@.param )
i then tried
exec (' ...
WHERE name IN (' + @.param + ')
')
and still nothing.
Does anybody know what i'm doing wrong?
Thank alot
Wim Horemans :confused:
p.s. in @.param there should be something like "jef, jan, gert, dunno"Your local variable should look like "'jef', 'jan', 'gert', 'dunno'"
and your where caluse should evaluate to
exec (' ...
WHERE name IN ('jef', 'jan', 'gert', 'dunno')
')
Newbie question : sample of XML Application ?
I am new to XML.
Could anybody please tell me sample of aplication / cases study where we
can make use of XML
(in general or especially in SQL Server 2000)
Thank you for your help,
Krist
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!I am not quite sure what you are looking for? Do you need a motivation to
use XML in the database? If you need that, you probably are fine with using
the relational feature and don't need to use XML. Otherwise,
http://msdn.microsoft.com/xml has whitepapers and other information...
Best regards
Michael
"Krist" <Kristanto@.me.com> wrote in message
news:uy4M%23m5KFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi All,
> I am new to XML.
> Could anybody please tell me sample of aplication / cases study where we
> can make use of XML
> (in general or especially in SQL Server 2000)
> Thank you for your help,
> Krist
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
Newbie question : sample of XML Application ?
I am new to XML.
Could anybody please tell me sample of aplication / cases study where we
can make use of XML
(in general or especially in SQL Server 2000)
Thank you for your help,
Krist
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
I am not quite sure what you are looking for? Do you need a motivation to
use XML in the database? If you need that, you probably are fine with using
the relational feature and don't need to use XML. Otherwise,
http://msdn.microsoft.com/xml has whitepapers and other information...
Best regards
Michael
"Krist" <Kristanto@.me.com> wrote in message
news:uy4M%23m5KFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi All,
> I am new to XML.
> Could anybody please tell me sample of aplication / cases study where we
> can make use of XML
> (in general or especially in SQL Server 2000)
> Thank you for your help,
> Krist
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!
Monday, March 26, 2012
Newbie question
various Xml classes. What I want to do is programatically create an xml
structure and store it in a database column, for example :-
<FlavourID>0</FlavourID>
<FormID>Form1</FormID>
<ItemKey>EmployeeName</ItemKey>
<PropertyKey>PropertyDataHere</PropertyKey>
<Value>ValueHere</Value>
is one such structure I might want to store in a database column. The reason
I dont store this in 5 columns is that the structure itself is variable. My
problems are :-
1) I dont know how to programatically create a structure - I'm confused with
XmlDocument, XmlDataDocument, XmlNode, XmlTextWriter etc. I basically want
to end up with one single datatype that can be stored in a single column in
a database, which brings me to the second problem:
2) I dont know the best way to store this in a database column. I know there
is some Xml support in SqlServer 2000 and more in 2005, but with something
as simple and small as this maybe converting and storing as Text or Varchar
would be sufficient.
Any help very gratefully appreciated !
"JezB" <jezbroadsword@.blueyonder.co.uk> wrote in message
news:Oxp2glBaEHA.524@.TK2MSFTNGP09.phx.gbl...
[snip]
> 1) I dont know how to programatically create a structure - I'm confused
> with
> XmlDocument, XmlDataDocument, XmlNode, XmlTextWriter etc. I basically want
> to end up with one single datatype that can be stored in a single column
> in
> a database, which brings me to the second problem:
Here are two good articles on Xml in .Net:
http://msdn.microsoft.com/library/de...ml03172004.asp
http://support.softartisans.com/kbview.aspx?ID=673
> 2) I dont know the best way to store this in a database column. I know
> there
> is some Xml support in SqlServer 2000 and more in 2005, but with something
> as simple and small as this maybe converting and storing as Text or
> Varchar
> would be sufficient.
In SQL Server 2000 you would store it as a text column.
Bryant
sql
Monday, March 12, 2012
Newbie here. Problems on bulk loading.
Hi guys. I am kinda new in XML bulk loading section. Several tutorials had been done by myself and I get some difficulties when having an attribute in my XML. Here are my table, XML and XML schema for bulk loading.
Tables :
CREATE TABLE [dbo].[Game](
[ID] [int] IDENTITY(1,1) NOT NULL,
[code] [int] NOT NULL,
CONSTRAINT [PK_Game] PRIMARY KEY CLUSTERED
(
[code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Match](
[ID] [int] NOT NULL,
[date] [datetime] NULL,
[gamecode] [int] NOT NULL,
CONSTRAINT [PK_Match] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Match] WITH CHECK ADD CONSTRAINT [FK_Match_Game] FOREIGN KEY([gamecode])
REFERENCES [dbo].[Game] ([code])
GO
ALTER TABLE [dbo].[Match] CHECK CONSTRAINT [FK_Match_Game]
XML :
<?xml version='1.0' encoding='utf-8'?>
<ROOT>
<game code="1"/>
<match id = "1001" date="2007/08/01" />
<match id = "1002" date="2007/08/02" />
</game>
<game code="2"/>
<match id = "1003" date="2007/08/03" />
<match id = "1004" date="2007/08/04" />
</game>
<game code="3"/>
<match id = "1005" date="2007/08/05" />
<match id = "1006" date="2007/08/06" />
</game>
</ROOT>
XML Schema :
<xsdchema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlnsql="urn
chemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="gameMatch"
parent="Game"
parent-key="code"
child="Deal"
child-key="gamecode" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="game" sql:relation="Game" >
<xsd:complexType>
<xsdequence>
<xsd:element name="Match"
sql:relation="Match"
sql:relationship="gameMatch" >
<xsd:complexType>
<xsd:attribute name="id" type="xsd:integer" /> -- error occurs on this attribute
</xsd:complexType>
</xsd:element>
</xsdequence>
<xsd:attribute name="date" type="xsdate" />
</xsd:complexType>
</xsd:element>
</xsdchema>
My problem solved. Just the element mistake.
Wednesday, March 7, 2012
Newbie - why store XML in Sql?
I don't understand why anyone would want to store pure XML data in SQL. Why not just parse the XML and store the information contained in "normal" (e.g. int, varchar) database fields?
TIA,
Barkingdog
Check http://msdn2.microsoft.com/en-us/library/ms187508.aspx, in particular the section "relational or XML data model" to find reason when it makes sense to use the XML data type in SQL server 2005.Saturday, February 25, 2012
Newbie - generate XML tree from parent-child hierarchy
I'm trying to do something that I know should be straightforward, but
I just cannot get it to work.
Imagine a simple Bill-Of-Materials with one table and a parent-child
relationship.
e.g. PartNumberID, ParentPartNumberID, PartDescription,
PartCost,...
Where ParentPartNumberID references PartnumberID, except at the top
level where it is NULL.
There are an unknown number of levels to this hierarchy
What I want to get out is an XML document something like this.
<root>
< PART ID =PartNumberID, Description = PartDescription>
< SUBPARTS>
< PART ID =PartNumberID, Description = PartDescription />
< PART ID =PartNumberID, Description = PartDescription />
< PART ID =PartNumberID, Description = PartDescription>
<SUBPARTS>
< PART ID =PartNumberID, Description =
PartDescription />
</SUBPARTS>
</SUBPARTS>
< PART ID =PartNumberID, Description = PartDescription/>
< PART ID =PartNumberID, Description = PartDescription/>
...
</root>
Where structure of the tree represents the same relationships as the
parent-child hierarchy does.
I'm sure this is entirely do-able, but I am stumped. I have quite a
lot of SQL expertise, but am relatively new to XML - and I'm sure I'm
simply looking at the problem from the wrong angle somehow.
Any help or pointers towards published solutions would be much
appreciated.
Thanks in advance,
Richard.
p.s.Please forgive me if this is the wrong place to post this, I've
read both this and the .programming group and I think this is the
more appropriate one.
Assuming SQL Server 2005
CREATE FUNCTION dbo.GetPartsSubTree(@.PartNumberID int)
RETURNS XML
BEGIN RETURN
(SELECT PartNumberID AS "@.ID",
PartDescription AS "@.Description",
dbo.GetPartsSubTree(PartNumberID)
FROM Parts
WHERE ParentPartNumberID=@.PartNumberID
ORDER BY PartNumberID
FOR XML PATH('PART'),ROOT('SUBPARTS'),TYPE)
END
GO
SELECT PartNumberID AS "@.ID",
PartDescription AS "@.Description",
dbo.GetPartsSubTree(PartNumberID)
FROM Parts
WHERE ParentPartNumberID is null
ORDER BY PartNumberID
FOR XML PATH('PART'),ROOT('Root'),TYPE
|||HI Mark,
Sorted! Thank you very much indeed.
Having got the solution I knew what to look for on the wenb, and a bit
of further digging on the PATH option found the following article,
which gives the same solution type as you do, and explains what the
various new features do.
http://msdn2.microsoft.com/en-us/library/ms345137.aspx
Best Regards,
Richard
Newbie - generate XML tree from parent-child hierarchy
I'm trying to do something that I know should be straightforward, but
I just cannot get it to work.
Imagine a simple Bill-Of-Materials with one table and a parent-child
relationship.
e.g. PartNumberID, ParentPartNumberID, PartDescription,
PartCost,...
Where ParentPartNumberID references PartnumberID, except at the top
level where it is NULL.
There are an unknown number of levels to this hierarchy
What I want to get out is an XML document something like this.
<root>
< PART ID =PartNumberID, Description = PartDescription>
< SUBPARTS>
< PART ID =PartNumberID, Description = PartDescription />
< PART ID =PartNumberID, Description = PartDescription />
< PART ID =PartNumberID, Description = PartDescription>
<SUBPARTS>
< PART ID =PartNumberID, Description =
PartDescription />
</SUBPARTS>
</SUBPARTS>
< PART ID =PartNumberID, Description = PartDescription/>
< PART ID =PartNumberID, Description = PartDescription/>
..
</root>
Where structure of the tree represents the same relationships as the
parent-child hierarchy does.
I'm sure this is entirely do-able, but I am stumped. I have quite a
lot of SQL expertise, but am relatively new to XML - and I'm sure I'm
simply looking at the problem from the wrong angle somehow.
Any help or pointers towards published solutions would be much
appreciated.
Thanks in advance,
Richard.
p.s.Please forgive me if this is the wrong place to post this, I've
read both this and the .programming group and I think this is the
more appropriate one.Assuming SQL Server 2005
CREATE FUNCTION dbo.GetPartsSubTree(@.PartNumberID int)
RETURNS XML
BEGIN RETURN
(SELECT PartNumberID AS "@.ID",
PartDescription AS "@.Description",
dbo.GetPartsSubTree(PartNumberID)
FROM Parts
WHERE ParentPartNumberID=@.PartNumberID
ORDER BY PartNumberID
FOR XML PATH('PART'),ROOT('SUBPARTS'),TYPE)
END
GO
SELECT PartNumberID AS "@.ID",
PartDescription AS "@.Description",
dbo.GetPartsSubTree(PartNumberID)
FROM Parts
WHERE ParentPartNumberID is null
ORDER BY PartNumberID
FOR XML PATH('PART'),ROOT('Root'),TYPE|||HI Mark,
Sorted! Thank you very much indeed.
Having got the solution I knew what to look for on the wenb, and a bit
of further digging on the PATH option found the following article,
which gives the same solution type as you do, and explains what the
various new features do.
http://msdn2.microsoft.com/en-us/library/ms345137.aspx
Best Regards,
Richard
Monday, February 20, 2012
newbee - Where can I find sqlxmlbulkload
read all refer to the XML Bulk Load tool with references to the
msdn.microsoft.com/xml site
Here I find more articles on how to use this tool, but not the download
itsselt.
Where can I find this?It's included in SQLXML - the latest version is at
http://www.microsoft.com/downloads/...DisplayLang=en.
Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Nils" <Nils@.discussions.microsoft.com> wrote in message
news:25D3844C-B7E7-47FE-8A4D-644073B6E9CB@.microsoft.com...
I want to import large XML files into my SQL 200 server. Several articles I
read all refer to the XML Bulk Load tool with references to the
msdn.microsoft.com/xml site
Here I find more articles on how to use this tool, but not the download
itsselt.
Where can I find this?
newbee - Where can I find sqlxmlbulkload
read all refer to the XML Bulk Load tool with references to the
msdn.microsoft.com/xml site
Here I find more articles on how to use this tool, but not the download
itsselt.
Where can I find this?
It's included in SQLXML - the latest version is at
http://www.microsoft.com/downloads/d...isplayLang=en.
Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Nils" <Nils@.discussions.microsoft.com> wrote in message
news:25D3844C-B7E7-47FE-8A4D-644073B6E9CB@.microsoft.com...
I want to import large XML files into my SQL 200 server. Several articles I
read all refer to the XML Bulk Load tool with references to the
msdn.microsoft.com/xml site
Here I find more articles on how to use this tool, but not the download
itsselt.
Where can I find this?