table studentinfo:

TID       BADGEID     NAME        Location    Addr
122        233.01      Katy         GA         GA-54
123        234.02      tery         GA         GA-54

I want to insert 0 after. like below

  TID       BADGEID     NAME        Location    Addr
    122        233.001      Katy         GA         GA-54
    123        234.002      tery         GA         GA-54

I have this solution in my mind not sure it's correct. worried if it's going to mess my data:

update studentinfo
set BADGEID = '.###'
where location = 'GA'
  • Your current query is going to update BADGEID = '.###' for all the records with the location GA. Are you trying to insert a new row? Or update existing ones. It's not clear. – Jacob H Mar 7 '19 at 20:13


UPDATE studentinfo
SET BadgeID = CAST(CAST(BadgeID as INT) + ABS(BadgeID-CAST(BadgeID AS INT))/10 AS 
WHERE location = 'GA'


UPDATE studentinfo
WHERE location = 'GA'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.