update question

  • I run the following queries:

    select top 10 LINKED_FLG,IMAGE_ACCOUNT_NUMBER

    from FACT_TXN_INFO

    where DATE_ID = 20100127

    and stack_number = 1

    and txn_type_id = 27

    update FACT_TXN_INFO

    set IMAGE_ACCOUNT_NUMBER = 'stephen'

    where DATE_ID = 20100127

    and stack_number = 1

    and txn_type_id = 27

    select top 10 LINKED_FLG,IMAGE_ACCOUNT_NUMBER

    from FACT_TXN_INFO

    where DATE_ID = 20100127

    and stack_number = 1

    and txn_type_id = 27

    update FACT_TXN_INFO

    set LINKED_FLG = 0

    where DATE_ID = 20100127

    and stack_number = 1

    and txn_type_id = 27

    select top 10 LINKED_FLG,IMAGE_ACCOUNT_NUMBER

    from FACT_TXN_INFO

    where DATE_ID = 20100127

    and stack_number = 1

    and txn_type_id = 27

    And the result is so unexpected.

    LINKED_FLG IMAGE_ACCOUNT_NUMBER

    ---------- ---------------------

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    (10 row(s) affected)

    (20392 row(s) affected)

    LINKED_FLG IMAGE_ACCOUNT_NUMBER

    ---------- ---------------------

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    0 stephen

    (10 row(s) affected)

    (20392 row(s) affected)

    LINKED_FLG IMAGE_ACCOUNT_NUMBER

    ---------- ---------------------

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    0 NULL

    (10 row(s) affected)

    I update the field 'IMAGE_ACCOUNT_NUMBER' to 'Stephen' (it is a varchar(20))

    and then update the field 'LINKED_FLG' to 0 (it is a bit)

    But after the update, the previous update value is gone!!

    ANY IDEA why it happens like this

  • Are there any triggers on the table?

  • No trigglers and purely no index on these two fields

  • Have you run a SQL trace? That should tell you exactly what is updating your column values to NULL.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • everything look normal in the trace.

    nothing happening 🙁

  • I would recommend making sure you have your trace configured correctly. The trace will capture all SQL activity. All changes to data whether from SP, trigger code, or a simple SQL batch will escape the Trace if properly configured.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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