Viewing 15 posts - 61 through 75 (of 388 total)
Yes, it can work on an XML column too. Here is an example
DECLARE @t TABLE (id int, data XML)
INSERT INTO @t(id, data) SELECT 1, '
...
July 23, 2009 at 2:05 am
Glad to know it helped.
I have written a series of XQuery tutorials at my blog site, in case you need further help.
regards
Jacob
July 22, 2009 at 10:55 am
andrew.sims (7/22/2009)
Would it also be possible to look at the same processes where the XML data is arranged like...
Jacob
NY
SQL Server
Steve
SQL Server
...
July 22, 2009 at 10:10 am
mg (7/22/2009)
July 22, 2009 at 10:05 am
Hi Yair,
All these are TSQL examples and hence you can run them in SQL Server Management Studio.
regards
Jacob
July 22, 2009 at 7:17 am
Here is an example that I just tried and it works
DECLARE @x XML(CustomerSchema), @y XML
SELECT @y = 'a'
BEGIN TRY
SELECT @x = @y
END TRY
BEGIN CATCH
RAISERROR('Hey, this is an invalid XML',16,1)
END CATCH
/*
OUTPUT:
Msg...
May 5, 2009 at 1:41 am
The regular expression language is documented here: http://www.w3.org/TR/xmlschema-2/#regexs
The documentation is not very easy to understand but you might be able to spot the problem with your syntax.
I have...
March 28, 2009 at 11:54 am
I wanted to come up with a PART 2 which focuses on using the results in an ASP.NET page (display paging information etc). Well, now I think there are enough...
March 28, 2009 at 11:46 am
Here is another version of the code that does not use the 'parent node accessor'
DECLARE @t TABLE (data XML)
INSERT INTO @t(data) SELECT '
[LocalGroups]
[LocalGroup]
[Name]Administrators[/Name]
[Description]Administrators have complete and...
March 20, 2009 at 2:41 pm
...and this example shows how to achieve it with a CROSS APPLY.
SELECT
p.value('@Id[1]','int') AS PropertyId,
c.value('(CountryCode/text())[1]', 'varchar(256)') as CountryCode,
c.value('(Number/text())[1]', 'varchar(256)') as PhoneNumber
FROM @x.nodes('//Property') n(p)
CROSS APPLY p.nodes('PhoneList/Phone') t(c)
March 18, 2009 at 12:37 pm
XML data type can store XML DOCUMENTS (having exactly 1 root element) and XML CONTENT (having 0 or more top level elements). The default is CONTENT and hence it...
March 9, 2009 at 1:04 pm
bdba,
I altered the query a bit. Here is the new version
SELECT
p.value('@Name', 'varchar(15)') AS ProductName,
p.value('@ID', 'int') AS ProductID,
i.value('@Keyname', 'varchar(15)') AS ItemName,
i.value('@Keyvalue', 'varchar(15)') AS ItemValue
FROM @MyXML.nodes('/MyXML/Product') x(p)
CROSS APPLY p.nodes('Item') y(i)
/*
ProductName ...
March 3, 2009 at 10:33 pm
Hi Charles, Thank you for pointing this out. I have corrected it, however, it might take a few days before the new version will be published.
Thanks
Jacob
February 25, 2009 at 10:25 am
Bishal,
I would recommend using .NET XML libraries to perform this, instead of trying to do this in TSQL. If ever you want to do it in TSQL, it would involve...
February 19, 2009 at 5:16 am
This article focuses on passing a table (a set of tabular data) to a stored procedure for further processing. It does not refer to passing one of the tables of...
February 16, 2009 at 4:17 am
Viewing 15 posts - 61 through 75 (of 388 total)