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
 for xml raw

Author  Topic 

lamujerdetuhermano10
Yak Posting Veteran

75 Posts

Posted - 2008-08-20 : 18:38:11

I like to get this working. I want to insert the record that do no exists in table @computersCA to table @computersNV but using for xml raw

declare @computersNV table (computerID int, computerName varchar(50),
computerPrice varchar(30), computerCheckDate datetime)
insert @computersNV
select 1, 'Rose', $1, convert(varchar(8), getdate()-5, 112) union all
select 4, 'John', $8 , convert(varchar(8), getdate()-5, 112)

declare @computersCA table (computerID int, computerName varchar(50), computerPrice money, computerDate datetime)
insert @computersCA
select 1, 'Rose', $5.6, convert(varchar(8), getdate(), 112) union all
select 2, 'Clark', $3.4, convert(varchar(8), getdate(), 112) union all
select 3, 'Marilyn', $6, convert(varchar(8), getdate(), 112) union all
select 4, 'Manuel', $8, convert(varchar(8), getdate(), 112)


declare @handle int
IF EXISTS ( SELECT 1 FROM OPENXML(@handle,'/ROOT/load',1))
insert @computersNV (computername)
select ixml.computername from OPENXML(@handle,'/ROOT/load',1)
with (computername varchar(50)) as ixml
where not exists (select ca.computerName from @computersCA ca
where ixml.computername = ca.computername )


   

- Advertisement -