SQL Jobs

  • Hi ,

    Is there anytable which stores information about the status of the job (i mean when job is in running mode).

    thanx

    from

    Killer

  • Hi,

    Chk this sp_help_job

    Thnx,

    Natalie

  • Hi,

    Good shot 

    I did it already but not the same as ur told me .

    I share with how i did it may help u .

    My question was i need the status of the running job.

    When the job get executed we can see the status in the sysprocess table.

    It is bit tepical becasue the column that contain the job id looks like the binary field but it is not true .

    for example the job id=FF476824-C5EF-4793-90AE-BF3B742E4ADC

    when u look in sysprocess it looks like this 0x246847FF-EFC5-9347-90AE-BF3B742E4ADC

    So i used this query to get the correct data and used it in a query to match with sysjobs table.

    CREATE TABLE #Test (col VARCHAR(50) NOT NULL)

    INSERT INTO #Test VALUES ('DFDDABBF-7079-4135-AAD8-1BDA58DB0CEB')

    SELECT col FROM #Test

    SELECT REVERSE(col) FROM #Test

    SELECT STUFF(col, 1, CHARINDEX('-',col), 'BFABDDDF-')

    FROM #Test

    DECLARE @t TABLE (Id INT IDENTITY, Name_Id UNIQUEIDENTIFIER)

    INSERT @t

          SELECT 'DFDDABBF-7079-4135-AAD8-1BDA58DB0CEB'

    UNION SELECT NEWID()

    UNION SELECT NEWID()

    SELECT * FROM @t

    SELECT

        Id,

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 7, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 5, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 3, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 1, 2) +

        '-' +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 12, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 10, 2) +

        '-' +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 17, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 15, 2) +

        SUBSTRING(CAST(Name_Id AS VARCHAR(40)), 19, 20)

    FROM

        @t

    (query help by SSC memebr)

    from

    Killer

  • Here's a handy link about the System Tables that no DBA should be without:

    http://www.microsoft.com/sql/prodinfo/previousversions/systables.mspx

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • Thanx Rudy,

     

    I had that help file.

    from

    Killer

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply