Here is how you register said schema:
CREATE XML SCHEMA COLLECTION MySchema AS
N'MyXSDDefinition'
My ramblings in Silverlight, Windows Azure, .NET, ASP.NET, C# (all the way from the UK) A little place where i can store the snippets of information, which usually get lost in my tiny little brain, and will now forever remain enshrined in the google archives forever.
CREATE XML SCHEMA COLLECTION MySchema AS
N'MyXSDDefinition'
SELECT CONVERT(Xml, Source)
FROM MyFiles
WHERE MyFileID=7
SELECT CONVERT(Xml(MySchema), Source)
FROM MyFiles
WHERE MyFileID=7
DECLARE @myXml Xml
SET @myXml = '<Customers>
<Customer Name=''Fred'' Organisation=''Default''/>
<Customer Name=''Bob'' Organisation=''Default'' />
</Customers>'
-- Update Roles
DECLARE @iNodeCount int
SET @iNodeCount = @myXml.value('count(/Customers/Customer[@Organisation=''Default''])','int')
DECLARE @iCurrentNode int
SET @iCurrentNode = 1
WHILE (@iCurrentNode <= @iNodeCount)
BEGIN
-- Update the root element with the default chargeband
SET @myXml.modify
('
insert attribute OrganisationId {5}
into (/Customers/Customer[@Organisation=''Default''][sql:variable("@iCurrentNode")])[1]
')
-- increment the loop
SET @iCurrentNode = @iCurrentNode + 1
END
SELECT @myXml