update book set idd= case charindex('-',idd) when 0 then idd
                                             when null then null
                                             else substring(idd,1,charindex('-',idd) -1) end