• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

add text in computed column formulas sql server

i want to add text in  computed column  of sql server i did this

([col1] & ' MyCustomText' & [col2)

but get error.
0
ajaymaster143
Asked:
ajaymaster143
1 Solution
 
Atdhe NuhiuCommented:
try ([col1] + ' MyCustomText' + [col2)

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if any of the columns is numnerical, you need to cast explicitly

cast(col1 as varchar(100)) + ' mycustomer text ' + cast(col2 as varchar(100))

0
 
ajaymaster143Author Commented:
Thanks It help me More
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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