Professional Web Applications Themes

Need more help on how to pass parameters from stored procedure into trigger - Microsoft SQL / MS SQL Server

Thanks oj for responding to my query. But since I am a novice I was able to decipher the statements but was not able to determine where should all these statments reside and how will they work. Just to refresh your memory, my question was how can I override the parameters defined in a trigger if an update statement is issued thru below defined stored procerdure instead of update being issued thru query yzer in that case, default values defined inside trigger update the audittrail table. Thanks so much Ricky Oj's solution : Ricky, Here is how you would do ...

  1. #1

    Default Need more help on how to pass parameters from stored procedure into trigger

    Thanks oj for responding to my query. But since I am a
    novice I was able to decipher the statements but was not
    able to determine where should all these statments reside
    and how will they work. Just to refresh your memory, my
    question was how can I override the parameters defined in
    a trigger if an update statement is issued thru below
    defined stored procerdure instead of update being issued
    thru query yzer in that case, default values defined
    inside trigger update the audittrail table.

    Thanks so much

    Ricky

    Oj's solution :

    Ricky,

    Here is how you would do it...

    create table tmp(dt datetime)
    go
    create proc _usp
    as

    select object_name(procid) as name
    into #tmp

    insert tmp(dt) select current_timestamp
    go

    create trigger _tr on tmp
    for insert
    as
    if rowcount=0 return

    if object_id('tempdb..#tmp','U') is not null
    select 'Calling Proc'=name
    from #tmp
    go

    exec _usp
    go



    My table structure is for PITRY is:

    Tagkey int
    Datetime smalldatetime
    Value real
    Quality tinyint
    Revlevel tinyint


    The update trigger defined on this table is :

    CREATE TRIGGER [UpdateStatusAndRevlevel] ON dbo.PITry
    FOR UPDATE
    AS

    declare sdtMinStartDate smalldatetime, sdtMaxEndDate
    smalldatetime, vcTagdatatable varchar(50), Stat tinyint
    declare vcComment varchar(8000), vcUser varchar(50),
    intIdentity int, Result real, Rev tinyint, bitRecalc
    bit, tintRev tinyint

    set vcTagdatatable = 'PITry'
    set vcUser = Upper(SYSTEM_USER)
    set vccomment = 'Update - Illegal Update statement issued
    by user: ' + vcUser
    set bitRecalc =0

    Select sdtMinStartDate = Min([datetime]) From deleted
    Select sdtMaxEndDate = Max([datetime]) From deleted


    insert into PITryAuditHistory (StartDate,EndDate,
    TagDataTable,
    [User],Comment,AuditedDatetime,RecalculateAvgFlag)
    Values (sdtMinStartDate, sdtMaxEndDate, vcTagdatatable,
    vcUser, vcComment,getdate(), bitRecalc)
    set intIdentity = identity

    If update(Value)
    Begin


    insert pitryaudit
    Select del.[key], del.[datetime], del.value, del.status,
    isnull(del.revlevel,0), intIdentity, getdate() from
    deleted as del, inserted as ins where (del.[key] = ins.
    [key]) and (del.[datetime] = ins.[datetime]) and
    (del.value <> ins.value)
    If ROWCOUNT = 0
    Begin

    set bitRecalc = 0

    set vccomment = 'Update - Illegal Update
    statement issued with the same Value as in the table,
    update aborted - user: ' + vcUser

    update pitry

    set Status = 97, Revlevel = (Select revlevel from
    deleted where deleted.[datetime] = pitry.[datetime] and
    deleted.[key] = pitry.[key] ) where datetime >=
    sdtMinStartDate and datetime <= sdtMaxEndDate

    End
    Else
    Begin

    set bitRecalc = 1

    set vccomment = 'Update - Illegal Update
    statement changed the [Value], update successful - user: '
    + vcUser

    update pitry

    set Status = 97, Revlevel = (Select revlevel from
    deleted where deleted.[datetime] = pitry.[datetime] and
    deleted.[key] = pitry.[key] ) where datetime >=
    sdtMinStartDate and datetime <= sdtMaxEndDate
    --
    set Status = 97, Revlevel =(Select isnull
    (d.revlevel,0)+1 from deleted as d where d.[datetime] =
    pitry.[datetime] and d.[key] = pitry.[key] and d.[key] in
    (Select ins.[key] from inserted ins, deleted del where ins.
    [key] = del.[key] and ins.[datetime] = del.[datetime] and
    ins.value <> del.value) and
    -- d.
    [datetime] in (Select ins.[datetime] from inserted ins,
    deleted del where ins.[key] = del.[key] and ins.[datetime]
    = del.[datetime] and ins.value <> del.value) ) where
    datetime >= sdtMinStartDate and datetime <= sdtMaxEndDate

    End
    -- update pitry
    -- set Status = 97,
    Revlevel = (Select revlevel from deleted where deleted.
    [datetime] = pitry.[datetime] and deleted.[key] = pitry.
    [key] ) where datetime >= sdtMinStartDate and datetime
    <= sdtMaxEndDate

    End
    Else if update(Status) or update
    (Revlevel)
    Begin

    set bitRecalc = 0
    -- set vccomment
    = 'Illegal Update statement changed the value, update
    successful, restored appropriate Status and Revlevel -
    user: ' + vcUser
    update pitry
    set Status =
    (Select Status from deleted where deleted.[datetime] =
    pitry.[datetime] and deleted.[key] = pitry.[key]),
    Revlevel = (Select
    revlevel from deleted where deleted.[datetime] = pitry.
    [datetime] and deleted.[key] = pitry.[key] ) where
    datetime >= sdtMinStartDate and datetime <= sdtMaxEndDate
    set vccomment
    = 'Update - Illegal Update statement issued on [Status] or
    [Revlevel] field, restoring appropriate status/revlevel -
    user: ' + vcUser
    -- set vccomment
    = 'Update - Illegal Update statement issued on field(s)
    other than [Value] - user: ' + vcUser
    End
    Else
    Begin
    set bitRecalc = 0
    set vccomment
    = 'Update - Illegal Update statement issued on field(s)
    other than [Value] or [Status] or [Revlevel] - user: ' +
    vcUser
    End

    update pitryaudithistory
    set RecalculateAvgFlag = bitRecalc, Comment = vcComment
    where AuditKey = intIdentity


    And the stored procedure that does an update is:

    CREATE PROCEDURE [dbo].[spPIUpdateTagTable]

    sdtStart smalldatetime=null, sdtEnd
    smalldatetime=null, rlValue real=null, intTagkey
    int=null, vcUser varchar(50)=null, vcComment varchar
    (8000)=null, vcResolution varchar(50)=null, bitRunTrig
    bit output, OvcUser varchar(50)=null output, OvcComment
    varchar(8000)=null output

    AS

    Declare vcTablename varchar(50), vcSQL varchar(8000)
    If sdtStart = null and sdtEnd = null and rlValue = null
    and intTagkey = null and vcUSer = null and vcComment =
    null and vcResolution = null
    Begin
    set bitRunTrig = 1
    End
    Else
    Begin
    set bitRunTrig = 0
    Select vcTablename = Case vcResolution
    When 'Minutely' Then 'TagDataMinutely '

    When 'Hourly' Then 'TagDataHourly '

    When 'Daily' Then 'TagDataDaily '


    END
    Set vcSQL = 'Update ' + vcTablename + '
    set Value = ' + convert(varchar(50), rlValue) + ' Where
    tagkey = ' + convert(varchar(50), intTagkey) + ' and
    [datetime] >= ' + '''' + convert(varchar(50),sdtStart)
    + ''''+ ' and [datetime] <= ' + '''' + convert(varchar
    (50),sdtEnd) + ''''
    Exec (vcSQL)
    set OvcUser = vcUser
    set OvcComment = vcComment

    End
    GO



    Ricky Guest

  2. #2

    Default Re: Need more help on how to pass parameters from stored procedure into trigger

    Ricky,

    As shown in my previous, you could store the procedure name in a temp table
    which you can later check in your trigger. This will allow you to
    accommodate your data however you like.

    In short, your stuff would look like this...

    CREATE TRIGGER [UpdateStatusAndRevlevel] ON dbo.PITry
    FOR UPDATE
    AS

    declare sdtMinStartDate smalldatetime, sdtMaxEndDate
    smalldatetime, vcTagdatatable varchar(50), Stat tinyint
    declare vcComment varchar(8000), vcUser varchar(50),
    intIdentity int, Result real, Rev tinyint, bitRecalc
    bit, tintRev tinyint

    IF object_id('tempdb..#tmp','U') is not null
    BEGIN
    --NEW values because the trigger is fired by sproc
    set vcTagdatatable = 'blah'
    set vcUser = Upper(SYSTEM_USER)
    set vccomment = 'Updated by SPROC - by user: ' + vcUser
    set bitRecalc =0

    Select sdtMinStartDate = Min([datetime]),
    sdtMaxEndDate = Max([datetime])
    From deleted
    END
    ELSE
    BEGIN
    --Do work as normal
    set vcTagdatatable = 'PITry'
    set vcUser = Upper(SYSTEM_USER)
    set vccomment = 'Update - Illegal Update statement issued
    by user: ' + vcUser
    set bitRecalc =0

    Select sdtMinStartDate = Min([datetime]) From deleted
    Select sdtMaxEndDate = Max([datetime]) From deleted
    END

    insert into PITryAuditHistory (StartDate,EndDate,
    TagDataTable,
    [User],Comment,AuditedDatetime,RecalculateAvgFlag)
    Values (sdtMinStartDate, sdtMaxEndDate, vcTagdatatable,
    vcUser, vcComment,getdate(), bitRecalc)
    set intIdentity = identity

    If update(Value)
    Begin


    insert pitryaudit
    Select del.[key], del.[datetime], del.value, del.status,
    isnull(del.revlevel,0), intIdentity, getdate() from
    deleted as del, inserted as ins where (del.[key] = ins.
    [key]) and (del.[datetime] = ins.[datetime]) and
    (del.value <> ins.value)
    If ROWCOUNT = 0
    Begin

    set bitRecalc = 0

    set vccomment = 'Update - Illegal Update
    statement issued with the same Value as in the table,
    update aborted - user: ' + vcUser

    update pitry

    set Status = 97, Revlevel = (Select revlevel from
    deleted where deleted.[datetime] = pitry.[datetime] and
    deleted.[key] = pitry.[key] ) where datetime >=
    sdtMinStartDate and datetime <= sdtMaxEndDate

    End
    Else
    Begin

    set bitRecalc = 1

    set vccomment = 'Update - Illegal Update
    statement changed the [Value], update successful - user: '
    + vcUser

    update pitry

    set Status = 97, Revlevel = (Select revlevel from
    deleted where deleted.[datetime] = pitry.[datetime] and
    deleted.[key] = pitry.[key] ) where datetime >=
    sdtMinStartDate and datetime <= sdtMaxEndDate
    --
    set Status = 97, Revlevel =(Select isnull
    (d.revlevel,0)+1 from deleted as d where d.[datetime] =
    pitry.[datetime] and d.[key] = pitry.[key] and d.[key] in
    (Select ins.[key] from inserted ins, deleted del where ins.
    [key] = del.[key] and ins.[datetime] = del.[datetime] and
    ins.value <> del.value) and
    -- d.
    [datetime] in (Select ins.[datetime] from inserted ins,
    deleted del where ins.[key] = del.[key] and ins.[datetime]
    = del.[datetime] and ins.value <> del.value) ) where
    datetime >= sdtMinStartDate and datetime <= sdtMaxEndDate

    End
    -- update pitry
    -- set Status = 97,
    Revlevel = (Select revlevel from deleted where deleted.
    [datetime] = pitry.[datetime] and deleted.[key] = pitry.
    [key] ) where datetime >= sdtMinStartDate and datetime
    <= sdtMaxEndDate

    End
    Else if update(Status) or update
    (Revlevel)
    Begin

    set bitRecalc = 0
    -- set vccomment
    = 'Illegal Update statement changed the value, update
    successful, restored appropriate Status and Revlevel -
    user: ' + vcUser
    update pitry
    set Status =
    (Select Status from deleted where deleted.[datetime] =
    pitry.[datetime] and deleted.[key] = pitry.[key]),
    Revlevel = (Select
    revlevel from deleted where deleted.[datetime] = pitry.
    [datetime] and deleted.[key] = pitry.[key] ) where
    datetime >= sdtMinStartDate and datetime <= sdtMaxEndDate
    set vccomment
    = 'Update - Illegal Update statement issued on [Status] or
    [Revlevel] field, restoring appropriate status/revlevel -
    user: ' + vcUser
    -- set vccomment
    = 'Update - Illegal Update statement issued on field(s)
    other than [Value] - user: ' + vcUser
    End
    Else
    Begin
    set bitRecalc = 0
    set vccomment
    = 'Update - Illegal Update statement issued on field(s)
    other than [Value] or [Status] or [Revlevel] - user: ' +
    vcUser
    End

    update pitryaudithistory
    set RecalculateAvgFlag = bitRecalc, Comment = vcComment
    where AuditKey = intIdentity


    GO


    CREATE PROCEDURE [dbo].[spPIUpdateTagTable]

    sdtStart smalldatetime=null, sdtEnd
    smalldatetime=null, rlValue real=null, intTagkey
    int=null, vcUser varchar(50)=null, vcComment varchar
    (8000)=null, vcResolution varchar(50)=null, bitRunTrig
    bit output, OvcUser varchar(50)=null output, OvcComment
    varchar(8000)=null output

    AS

    IF object_id('tempdb..#tmp','U') is not null
    drop table #tmp

    select object_name(procid) as name
    into #tmp

    Declare vcTablename varchar(50), vcSQL varchar(8000)
    If sdtStart = null and sdtEnd = null and rlValue = null
    and intTagkey = null and vcUSer = null and vcComment =
    null and vcResolution = null
    Begin
    set bitRunTrig = 1
    End
    Else
    Begin
    set bitRunTrig = 0
    Select vcTablename = Case vcResolution
    When 'Minutely' Then 'TagDataMinutely '
    When 'Hourly' Then 'TagDataHourly '
    When 'Daily' Then 'TagDataDaily '
    END
    Set vcSQL = 'Update ' + vcTablename + '
    set Value = ' + convert(varchar(50), rlValue) + ' Where
    tagkey = ' + convert(varchar(50), intTagkey) + ' and
    [datetime] >= ' + '''' + convert(varchar(50),sdtStart)
    + ''''+ ' and [datetime] <= ' + '''' + convert(varchar
    (50),sdtEnd) + ''''
    Exec (vcSQL)
    set OvcUser = vcUser
    set OvcComment = vcComment

    End
    GO



    --
    -oj
    RAC v2.2 & QALite!
    [url]http://www.rac4sql.net[/url]



    "Ricky" <ricky.arorametc.state.mn.us> wrote in message
    news:00a701c33f32$abdfa020$a501280aphx.gbl...
    > Thanks oj for responding to my query. But since I am a
    > novice I was able to decipher the statements but was not
    > able to determine where should all these statments reside
    > and how will they work. Just to refresh your memory, my
    > question was how can I override the parameters defined in
    > a trigger if an update statement is issued thru below
    > defined stored procerdure instead of update being issued
    > thru query yzer in that case, default values defined
    > inside trigger update the audittrail table.
    >
    > Thanks so much
    >
    > Ricky
    >

    oj Guest

  3. #3

    Default Re: Need more help on how to pass parameters from stored procedure into trigger

    Thanks so much oj. It worked. I even was able to insert
    paramters from sp to a temp table and use them if that
    temp table existed instead of pre defined paramters inside
    trigger. You are a genuis....

    >-----Original Message-----
    >Ricky,
    >
    >As shown in my previous, you could store the procedure
    name in a temp table
    >which you can later check in your trigger. This will
    allow you to
    >accommodate your data however you like.
    >
    >In short, your stuff would look like this...
    >
    >CREATE TRIGGER [UpdateStatusAndRevlevel] ON dbo.PITry
    >FOR UPDATE
    >AS
    >
    >declare sdtMinStartDate smalldatetime, sdtMaxEndDate
    >smalldatetime, vcTagdatatable varchar(50), Stat tinyint
    >declare vcComment varchar(8000), vcUser varchar(50),
    >intIdentity int, Result real, Rev tinyint, bitRecalc
    >bit, tintRev tinyint
    >
    >IF object_id('tempdb..#tmp','U') is not null
    >BEGIN
    >--NEW values because the trigger is fired by sproc
    >set vcTagdatatable = 'blah'
    >set vcUser = Upper(SYSTEM_USER)
    >set vccomment = 'Updated by SPROC - by user: ' + vcUser
    >set bitRecalc =0
    >
    >Select sdtMinStartDate = Min([datetime]),
    > sdtMaxEndDate = Max([datetime])
    >From deleted
    >END
    >ELSE
    >BEGIN
    >--Do work as normal
    >set vcTagdatatable = 'PITry'
    >set vcUser = Upper(SYSTEM_USER)
    >set vccomment = 'Update - Illegal Update statement issued
    >by user: ' + vcUser
    >set bitRecalc =0
    >
    >Select sdtMinStartDate = Min([datetime]) From deleted
    >Select sdtMaxEndDate = Max([datetime]) From deleted
    >END
    >
    >insert into PITryAuditHistory (StartDate,EndDate,
    >TagDataTable,
    >[User],Comment,AuditedDatetime,RecalculateAvgFlag)
    >Values (sdtMinStartDate, sdtMaxEndDate, vcTagdatatable,
    >vcUser, vcComment,getdate(), bitRecalc)
    >set intIdentity = identity
    >
    >If update(Value)
    >Begin
    >
    >
    >insert pitryaudit
    >Select del.[key], del.[datetime], del.value, del.status,
    >isnull(del.revlevel,0), intIdentity, getdate() from
    >deleted as del, inserted as ins where (del.[key] = ins.
    >[key]) and (del.[datetime] = ins.[datetime]) and
    >(del.value <> ins.value)
    >If ROWCOUNT = 0
    >Begin
    >
    >set bitRecalc = 0
    >
    >set vccomment = 'Update - Illegal Update
    >statement issued with the same Value as in the table,
    >update aborted - user: ' + vcUser
    >
    >update pitry
    >
    >set Status = 97, Revlevel = (Select revlevel from
    >deleted where deleted.[datetime] = pitry.[datetime] and
    >deleted.[key] = pitry.[key] ) where datetime >=
    >sdtMinStartDate and datetime <= sdtMaxEndDate
    >
    >End
    >Else
    >Begin
    >
    >set bitRecalc = 1
    >
    >set vccomment = 'Update - Illegal Update
    >statement changed the [Value], update successful - user: '
    >+ vcUser
    >
    >update pitry
    >
    >set Status = 97, Revlevel = (Select revlevel from
    >deleted where deleted.[datetime] = pitry.[datetime] and
    >deleted.[key] = pitry.[key] ) where datetime >=
    >sdtMinStartDate and datetime <= sdtMaxEndDate
    >--
    >set Status = 97, Revlevel =(Select isnull
    >(d.revlevel,0)+1 from deleted as d where d.[datetime] =
    >pitry.[datetime] and d.[key] = pitry.[key] and d.[key] in
    >(Select ins.[key] from inserted ins, deleted del where
    ins.
    >[key] = del.[key] and ins.[datetime] = del.[datetime] and
    >ins.value <> del.value) and
    >-- d.
    >[datetime] in (Select ins.[datetime] from inserted ins,
    >deleted del where ins.[key] = del.[key] and ins.[datetime]
    >= del.[datetime] and ins.value <> del.value) ) where
    >datetime >= sdtMinStartDate and datetime <=
    sdtMaxEndDate
    >
    >End
    >-- update pitry
    >-- set Status = 97,
    >Revlevel = (Select revlevel from deleted where deleted.
    >[datetime] = pitry.[datetime] and deleted.[key] = pitry.
    >[key] ) where datetime >= sdtMinStartDate and datetime
    ><= sdtMaxEndDate
    >
    >End
    >Else if update(Status) or update
    >(Revlevel)
    >Begin
    >
    >set bitRecalc = 0
    >-- set vccomment
    >= 'Illegal Update statement changed the value, update
    >successful, restored appropriate Status and Revlevel -
    >user: ' + vcUser
    >update pitry
    >set Status =
    >(Select Status from deleted where deleted.[datetime] =
    >pitry.[datetime] and deleted.[key] = pitry.[key]),
    >Revlevel = (Select
    >revlevel from deleted where deleted.[datetime] = pitry.
    >[datetime] and deleted.[key] = pitry.[key] ) where
    >datetime >= sdtMinStartDate and datetime <=
    sdtMaxEndDate
    >set vccomment
    >= 'Update - Illegal Update statement issued on [Status] or
    >[Revlevel] field, restoring appropriate status/revlevel -
    >user: ' + vcUser
    >-- set vccomment
    >= 'Update - Illegal Update statement issued on field(s)
    >other than [Value] - user: ' + vcUser
    >End
    >Else
    >Begin
    >set bitRecalc = 0
    >set vccomment
    >= 'Update - Illegal Update statement issued on field(s)
    >other than [Value] or [Status] or [Revlevel] - user: ' +
    >vcUser
    >End
    >
    >update pitryaudithistory
    >set RecalculateAvgFlag = bitRecalc, Comment = vcComment
    >where AuditKey = intIdentity
    >
    >
    >GO
    >
    >
    >CREATE PROCEDURE [dbo].[spPIUpdateTagTable]
    >
    >sdtStart smalldatetime=null, sdtEnd
    >smalldatetime=null, rlValue real=null, intTagkey
    >int=null, vcUser varchar(50)=null, vcComment varchar
    >(8000)=null, vcResolution varchar(50)=null, bitRunTrig
    >bit output, OvcUser varchar(50)=null output, OvcComment
    >varchar(8000)=null output
    >
    >AS
    >
    >IF object_id('tempdb..#tmp','U') is not null
    >drop table #tmp
    >
    >select object_name(procid) as name
    >into #tmp
    >
    >Declare vcTablename varchar(50), vcSQL varchar(8000)
    >If sdtStart = null and sdtEnd = null and rlValue = null
    >and intTagkey = null and vcUSer = null and vcComment =
    >null and vcResolution = null
    >Begin
    >set bitRunTrig = 1
    >End
    >Else
    >Begin
    >set bitRunTrig = 0
    >Select vcTablename = Case vcResolution
    >When 'Minutely' Then 'TagDataMinutely '
    >When 'Hourly' Then 'TagDataHourly '
    >When 'Daily' Then 'TagDataDaily '
    >END
    >Set vcSQL = 'Update ' + vcTablename + '
    >set Value = ' + convert(varchar(50), rlValue) + ' Where
    >tagkey = ' + convert(varchar(50), intTagkey) + ' and
    >[datetime] >= ' + '''' + convert(varchar(50),sdtStart)
    >+ ''''+ ' and [datetime] <= ' + '''' + convert(varchar
    >(50),sdtEnd) + ''''
    >Exec (vcSQL)
    >set OvcUser = vcUser
    >set OvcComment = vcComment
    >
    >End
    >GO
    >
    >
    >
    >--
    >-oj
    >RAC v2.2 & QALite!
    >[url]http://www.rac4sql.net[/url]
    >
    >
    >
    >"Ricky" <ricky.arorametc.state.mn.us> wrote in message
    >news:00a701c33f32$abdfa020$a501280aphx.gbl...
    >> Thanks oj for responding to my query. But since I am a
    >> novice I was able to decipher the statements but was not
    >> able to determine where should all these statments
    reside
    >> and how will they work. Just to refresh your memory, my
    >> question was how can I override the parameters defined
    in
    >> a trigger if an update statement is issued thru below
    >> defined stored procerdure instead of update being issued
    >> thru query yzer in that case, default values defined
    >> inside trigger update the audittrail table.
    >>
    >> Thanks so much
    >>
    >> Ricky
    >>
    >
    >
    >.
    >
    Ricky Guest

Similar Threads

  1. Pass a Date to stored procedure
    By Mike Lopez in forum ASP.NET Web Services
    Replies: 1
    Last Post: January 25th, 10:06 PM
  2. Optional Parameters ASP to SQL stored procedure
    By ross in forum ASP Database
    Replies: 0
    Last Post: May 25th, 02:53 PM
  3. Replies: 2
    Last Post: September 9th, 12:07 PM
  4. How to Pass stored procedure parameters inside trigger
    By Ricky in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: June 30th, 09:52 PM
  5. Creating a trigger that calls a stored procedure
    By Elie in forum Oracle Server
    Replies: 2
    Last Post: December 29th, 06:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139