Solved

how set a column to a description concatenated with a value

Posted on 2010-11-29
4
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Negative isnull? 3 32
SQL profiler 3 51
What does "Between" mean? 6 48
t-sql left join 2 34
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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