Extracting XML field in SQL Server -
i have fldxml
column in miwod
table contains multiple type of data. how can display [fldxml]
column value shown below?
routing drawing 1 c:\users\xxx\documents\lettuce_wheel.pdf
here how [fldxml]
looks like
<fields> <field1>1</field1> <field2>c:\users\xxx\documents\lettuce_wheel.pdf</field2> </fields>
i want this
routing drawing: 1 c:\users\xxx\documents\lettuce_wheel.pdf
i tried using following
select miwod.fldxml('(field1/text())[1]', 'varchar(50)') routing, miwod.fldxml('(field1/text())[1]', 'varchar(50)') routing [misampco].[dbo].[miwod]
but following error
cannot find either column "miwod" or user-defined function or aggregate "miwod.fldxml", or name ambiguous.
declare @stuff xml set @stuff = '<fields><field1>1</field1><field2>c:\users\kinfe\documents\lettuce_wheel.pdf</field2></fields>' select child.value('field1[1]', 'int') [**routing:**], child.value('field2[1]', 'nvarchar(max)') [**drawing:**] @stuff.nodes('fields[1]') n(child)
Comments
Post a Comment