Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 XMl data is not geeting inserted to table

Author  Topic 

divyaram
Posting Yak Master

180 Posts

Posted - 2014-09-10 : 06:17:10
Data is not getting insert into table .Below mentioned is the query used .could you help me on getting the data inserted to the table

DECLARE @FilterTable Table
(
ColumnName varchar(50),
Value varchar(250),
Type varchar(50)

)
DECLARE @ParamListXML XML
SET @ParamListXML = '<ROOT><Parameter Field="WBSProject" Filter="" Type="string" /><Parameter Field="GLCode" Filter="3x5450" Type="string" /><Parameter Field="LevelDomainId" Filter="0" Type="num" /></ROOT>'


INSERT INTO @FilterTable(ColumnName,Value,Type)
SELECT
[Table].[Column].value('(Field)[1]','varchar(50)') 'ColumnName',
[Table].[Column].value('(Filter)[1]','varchar(250)') 'Value',
[Table].[Column].value('(Type) [1]','varchar(50)') 'Type'
FROM @ParamListXML.nodes('/ROOT/Parameter') [Table]([Column])
Select * from @FilterTable

Regards,
Divya

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-09-10 : 06:21:28
[code]INSERT @FilterTable
(
ColumnName,
Value,
[Type]
)
SELECT col.value('(@Field)[1]', 'VARCHAR(50)') AS ColumnName,
col.value('(@Filter)[1]', 'VARCHAR(250)') AS Value,
col.value('(@Type) [1]', 'VARCHAR(50)') AS [Type]
FROM @ParamListXML.nodes('(/ROOT/Parameter)') AS tbl(col);

SELECT * FROM @FilterTable;[/code]


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
   

- Advertisement -