Kaseya Community

Database Views Problem

  • Have looked at all the great info here and have been able to create a view for the patch source info from the ksubscriber database. In SQL Management Studio the view works fine ie it returns columns with the right info.

    Here is the SQL producing the view:
    SELECT dbo.machNameTab.machName, dbo.patchParams.sourceType, dbo.patchParams.sourcePath AS Source, dbo.patchParams.sourceLocal,
    dbo.patchParams.sourceMachineId
    FROM dbo.machNameTab INNER JOIN
    dbo.patchParams ON dbo.machNameTab.agentGuid = dbo.patchParams.agentGuid

    However if I try to write a query such as the following:
    select source from vITWESTview where (machine_groupid='peterv-pc.itwest.dubbo')
    I always get:
    Msg 208, Level 16, State 1, Line 1
    Invalid object name 'vITWESTview'.

    And when I run this simple script:
    Script Name: Test Patch Source
    Script Description:

    IF True
    THEN
    Get Variable
    Parameter 1 : 11
    Parameter 2 : vITWESTview/source
    Parameter 3 : ksource
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : Source Path is: #ksource#
    OS Type : 0
    ELSE

    It errors with:
    FAILED in processing THEN step 1, Get Variable, with error SQL query failed to return data in GetVariable task, SELECT source FROM vITWESTview WHERE (Machine_GroupID='peterv-pc.itwest.dubbo')

    I have given the KaseyaReporting role Select permission to the view.

    Anyone can point me in the right direction? It would be much appreciated

    Legacy Forum Name: Database Views Problem,
    Legacy Posted By Username: petervane
  • Post a reply in the other post on this same issue.

    MachineGroupID does exist in that view. You need to either create it in the view or use machineName or SourceMachineID.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: doug.jenkins@ispire.ca