SQL Server – How to Update Field with Leading Sign

sql serversql-server-2005

I have a table where I need to insert a '*' sign before a lot of names. My table looks like this now:

id,name

1,cake
2,car
3,mountain

And it should be:

id,name

1,*cake
2,car
3,*mountain

The name column is nvarchar. I have the ids in a csv file. I thought I could make the update statement with concat and a where clause with the IDs, but I can't get it to work.

I tried

UPDATE table
SET    NAME = concat('*', NAME)
WHERE  id = '1'
        OR id = '2' 

But got

Msg 195, Level 15, State 10, Line 11 'concat' is not a recognized
built-in function name

Best Answer

Begin Tran
    Create Table #TEMP(id INT,name NVARCHAR(50))

        INSERT INTO #TEMP
        SELECT 1,'cake' UNION ALL
        SELECT 2,'car' UNION ALL
        SELECT 3,'mountain'

        UPDATE #TEMP
        SET    NAME = +'*'+ NAME
        WHERE  id = '1' OR id = '2' 

        Select * from #TEMP

ROLLBACK TRAN