Отвечено Calling a Function

  • 22 мая 2012 г. 8:54
     
     

    Hi All

    still learning sql - so appologies for this elementry question

    wrinting a sql statement and I need to call a function that I created

    the function is called

    ''SCC2012_PatchStates'' = ([dbo].[zf_SCC2012_PatchStates] (Patch,State))

    select
    sys.Netbios_Name0,
    UCom.StateType,
    UCom.StateID,
    Ucom.CI_ID,
    UCIS.BulletinID,
    UCIS.ArticleID
    FROM
    dbo.V_R_SYSTEM as sys
    INNER JOIN
    dbo.v_UpdateState_Combined as UCom on sys.resourceid = ucom.resourceid

    inner join
    dbo.v_UpdateCIs as UCIS on ucis.ci_id = ucom.ci_id

    --and sys.netbios_name0 like 'LABSCCM2012-CN'
    and ucIs.ArticleID not like ''
    and ucIs.Severity not like '0'

Все ответы

  • 22 мая 2012 г. 9:34
     
     Отвечено С кодом
    It depends on your functions result type, e.g.
    SELECT  sys.Netbios_Name0 ,
            UCom.StateType ,
            UCom.StateID ,
            Ucom.CI_ID ,
            UCIS.BulletinID ,
            UCIS.ArticleID ,
            [dbo].[zf_SCC2012_PatchStates](Patch, [State])
    FROM    dbo.V_R_SYSTEM AS sys
            INNER JOIN dbo.v_UpdateState_Combined AS UCom ON sys.resourceid = ucom.resourceid
            INNER JOIN dbo.v_UpdateCIs AS UCIS ON ucis.ci_id = ucom.ci_id
                                                  AND ucIs.ArticleID NOT LIKE ''
                                                  AND ucIs.Severity NOT LIKE '0';