|
Posted by rhaazy on 06/30/06 17:58
rhaazy wrote:
> Yes, I want to mimick the Merge Statement! Yay!
>
> Thanks for clearing that up for me, the example you have and the page
> were helpful however I still can't get the d*** thing to work right...
UPDATE tblScanDetail set GUIID = #temp.ID, GUIParentID =
#temp.ParentID, AttributeValue = #temp.scanattribute, LastModified =
getdate()
OUTPUT inserted.GUIID into @updated
FROM tblScanDetail INNER JOIN #temp
ON (tblScanDetail.GUIID = #temp.ID AND
tblScanDetail.GUIParentID =
#temp.ParentID AND tblScanDetail.AttributeValue = #temp.scanattribute)
WHERE MAC = @MAC
INSERT INTO tblScanDetail (MAC, GUIID, GUIParentID, ScanAttributeID,
ScanID, AttributeValue, DateCreated, LastModified)
SELECT @MAC, #temp.ID, #temp.ParentID,
tblScanAttribute.ScanAttributeID, @scanid,
#temp.scanattribute, DateCreated = getdate(),
LastModified =
getdate()
FROM tblScan, tblScanAttribute JOIN #temp
ON tblScanAttribute.Name = #temp.Name
WHERE GUIID not in (select GUIID from @updated)
I get an error when I do this, but I believe this to be the correct
method whats wrong?
[Back to original message]
|