Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how set a column to a description concatenated with a value

Posted on 2010-11-29
4
Medium Priority
?
251 Views
Last Modified: 2012-06-27
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
Comment
Question by:solarisinfosys
  • 2
4 Comments
 
LVL 7

Expert Comment

by:luceysupport
ID: 34236869
should be

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

you may also need convert(nvarchar, te.Quantity)
0
 
LVL 4

Accepted Solution

by:
MSSystems earned 2000 total points
ID: 34238641
Maybe try something like this

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

Open in new window

0
 

Author Closing Comment

by:solarisinfosys
ID: 34253714
MSSystems
 
Thank You. this is exactly the solution I was looking for.
0
 
LVL 7

Expert Comment

by:luceysupport
ID: 34255324
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question