Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

how set a column to a description concatenated with a value

SET SubDescription1 = 'MTD:'  SubDescription1 + te.Quantity,

I'm trying to use this code but I'm getting the following error

Incorrect syntax near 'SubDescription1'.
0
solarisinfosys
Asked:
solarisinfosys
  • 2
1 Solution
 
luceysupportCommented:
should be

SET SubDescription1 = 'MTD:'  + SubDescription1 + te.Quantity

you may also need convert(nvarchar, te.Quantity)
0
 
MSSystemsCommented:
Maybe try something like this

SET SubDescription1 = 'MTD:' + Cast([SubDescription1] as NvarChar(100)) + Cast([te].[Quantity] as NvarChar(100))

Open in new window

0
 
solarisinfosysAuthor Commented:
MSSystems
 
Thank You. this is exactly the solution I was looking for.
0
 
luceysupportCommented:
The solution to your problem was the + was missing as per my response. You did not specify the data types of your columns so I don't see how an answer that assumes them could be more correct.

I would object to how these points were awarded
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now