13

I am trying to add string "Rs" with amount column. The data type of amount is integer. But Sql is not allowing me to concatenate string with int data type column.Image 1

Image 2

0

1 Answer 1

20

You need to explicitly convert the int to varchar before concatenating with any string

select 'RS'+cast(total_amount as varchar(100)),*
from yourtable

If you are sql server 2012+ then use CONCAT which does implicit conversion

select Concat('RS',total_amount),*
from yourtable
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.