help with sql statement

  • I am trying to update a column named endtime with current date based on a specific value in another column using following statement:

    update

    metadata.dbo.tabledetail

    set

    endtime = (Select getdate()

    where

    metadata.dbo.tabledetail = 'pdsadmin.person'

    )

    go

     

    but getting an error:

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "metadata.dbo.tabledetail" could not be bound.

    How can I accomplish this task?

  • Hi,

    If I understand you correctly then you have to put a join into your update statement something like this...

    UPDATE tablename1 SET EndTime = getdate()

    FROM tablename1 a

    JOIN tablename2 b

    ON a.columnname = b.columnname

    WHERE b.columnname = 'FilterText'

    It might be a good idea to go through the UPDATE clause in books online as I've written that syntax from memory. Check out msdn for full documentation if you don't have a local copy.

     

    Kindest Regards,

    Frank Bazan

  • I guess you are trying to do this:

    update metadata.dbo.tabledetail set endtime = getdate()

    where

    metadata.dbo.tabledetail.PutYourFieldNameHere = 'pdsadmin.person'

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

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