Msg 512, Level 16, State 1, Line 1

  • Update FactTNx

    set ListKey = (Select a.ListKey

    from FactWTx a

    inner join

    FactTNx b ON a.KxID = b.KxID)

    common coloumn kxid

    Error:

    Msg 512, Level 16, State 1, Line 1

    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

    The statement has been terminated.

    I am trying to update a newly added column in fact table getting the data from another fact table.

    Can any one suggest me a solution for this.

    Thanks!!!!

  • Multiple rows are your problem. Just put a top 1 in your sub query. However you need to evaluate the business logic.

  • ThanKs, it worked.

  • crazekalyan (1/17/2011)


    ThanKs, it worked.

    Did you test if the results are correct? Adding a TOP 1 query would avoid the error but will most probably give you incorrect results. Please provide some sample data and the DDL scripts as mentioned in the link in my signature. This will help people give you tested answers.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

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

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