This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Get the not Updated CIDs from Sophos Database

Hello,

I am trying to get informations regarding the not updated CIDs from Sophos Database.

These informations are available within an XML field in the SDDM_Servers tables.

I am trying to extract these informations but in vain.

Did any one tried this before?

here is my SQL Query:

"

declare @CID table
(
CIDName varchar(100),
DeliveryResult varchar(100),
LastUpdate varchar(100)
)
declare @DeliveryResult varchar(50)
declare @lastNonNullDeliveryAt varchar(50)
declare @myDoc XML

declare @SUM varchar(50)
Set @SUM = 'xxx'
Set @myDoc = (select [StatusXML] from [SOPHOS550].[dbo].[SDDMServers] where LastName like @SUM)
select @myDoc
declare @test varchar(100)
set @test = @myDoc.value('(//status/updateManager/distributionGroup/distribution/distributionSite/unc/@uri)[10]','varchar(100)')
select @test

insert into @CID  (CIDName,DeliveryResult,LastUpdate)
SELECT
cidstatut.uri.value('(@uri)[1]','varchar(100)'),
statut.cidSate.value('(@deliveryResult)[1]','varchar(100)'),
statut.cidSate.value('(@lastNonNullDeliveryAt)[1]','varchar(100)')
FROM  @myDoc.nodes('/status/updateManager/distributionGroup/distribution') statut(cidSate)
cross apply statut.cidSate.nodes('/distributionSite/unc') as cidstatut(uri)
where cidSate.value('@deliveryResult','varchar(100)') not like 'NullSuccess%'

select * from @CID

"

Thank you for your help



This thread was automatically locked due to age.
Parents
  • Hello Rihab Chebbah1,

    may I ask why you want this information and how you could put it to use? Do you have recurring updating problems?

    As for the SQL - I'd have to test it or take a closer look. It doesn't produce any output or gives an error?

    Christian

  • Hello Christian,

    I want to automatic the monitoring of the CIDs' behaviour if they are taking and distributing the updates. if there is any problem regarding this topic, then I would have an email.

    I discovered why I can't get any displayed data: its because the <updateManager> tag has attributes (the parent tag).

    if we try it manually (copy the content of the XML and delete the attributes of the <updateManager> tag, then we get correct outputs.

    the data that I want to have are under <updateManager>

    No errors are displayed, only empty fields.

    Rihab

  • Hello Rihab,

    I see. Please note that it is not unusual to have transient errors, i.e. a failed delivery for one or more CIDs that succeeds on the next automatic update without any intervention.

    I'm a SQL and XML ignorant and until yesterday I hadn't touched XML with SQL so the following might be incorrect but it seems to do:
    SET QUOTED_IDENTIFIER ON
    DECLARE @SUM  varchar(50) = 'xxx'
    DECLARE @myDoc XML
    SET @myDoc = (SELECT [StatusXML] FROM [SOPHOS550].[dbo].[SDDMServers] WHERE LastName like @SUM)

    SELECT CID.value('(@uri)[1]','varchar(80)') AS CIDName,
           CID.value('(../../@deliveryResult)[1]','varchar(30)') AS DeliveryResult,  
           CID.value('(../../@lastNonNullDeliveryAt)[1]','datetime') AS LastUpdate  
       FROM @myDoc.nodes('//*[@uri]') X(CID)
       WHERE CID.value('local-name(.)','varchar(20)') = 'unc' AND
             CID.value('(../../@deliveryResult)[1]','varchar(30)') <> 'NullSuccess'
       ORDER BY CIDName     
     GO

    Christian
     

  • Hello Christian,

    It is also the first time for me to deal with XML using SQL Queries. It will be a good challenge :)

    Thank you for your try and your hard work but still empty values. I will try more and if I have a good feedback, I will update this case

Reply
  • Hello Christian,

    It is also the first time for me to deal with XML using SQL Queries. It will be a good challenge :)

    Thank you for your try and your hard work but still empty values. I will try more and if I have a good feedback, I will update this case

Children