sql-server-2005

SQL: Updating a field with a sub-query


I'm trying to change all the values I have in one column (string) in my table to all lowercase letters. I've tried this statement:

update LoanerHeader t1 set Requester = (select LOWER(Requester) from LoanerHeader t2 where t2.ISO_ID = t1.ISO_ID)

But am getting the following error: Incorrect syntax near 't1'.
I don't really understand why this isn't working, because the answer to this following question has similar syntax. Can anyone help me out? Thx.


Solution

  • You don't need to use a subquery. You can just do:

    UPDATE LoanerHeader SET Requester = LOWER(Requester);