I have a database student(attribute - studentid). studentid is a varchar. Now I want to add 'P' at the end of all studentids.
12 -> 12P 234 -> 234P
What will be the sql query for this?
I have a database student(attribute - studentid). studentid is a varchar. Now I want to add 'P' at the end of all studentids.
12 -> 12P 234 -> 234P
What will be the sql query for this?
This is for SQL Server:
select cast(Studentid as varchar) +'P' from student
UPDATE mytable
SET student_id = student_id + 'P' --assumes already varchar
WHERE RIGHT(student_id, 1) <> 'P' --to stop having PP at end...