0

I want to update some column and trying to add .jpg at the end of the value. Values example 4003 and I'm trying to update ImageFileName column to 4003.jpg but QuestionId is INT. I tried to be INT but did not do it. Thanks for help

UPDATE Questions 
SET ImageFileName = (QuestionId + '.jpg')
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

1

QuestionId is an integer column. You will need to convert to string before append with .jpg

update Questions
set    ImageFileName = convert(varchar(10), QuestionId) + '.jpg'

or simply use concat(). It will handle that

update Questions
set    ImageFileName = concat(QuestionId, '.jpg')
Squirrel
  • 23,507
  • 4
  • 34
  • 32