Improve company productivity with a Business Account.Sign Up

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

convert date to text

I am trying to concatenate 2 attributes of different data types...

One is date (TRANS_DT), and another one is text (Customer_Name)

I am usign the following query

select
(TRANS_DT+Customer_Name) as key_combo
from
table_A

getting an error message
"Syntax error converting datetime from character string."

Please advice...
0
redgreenred
Asked:
redgreenred
  • 2
1 Solution
 
chapmandewCommented:

select
(cast(TRANS_DT as varchar(30)) +Customer_Name) as key_combo
from
table_A
0
 
redgreenredAuthor Commented:
getting the same error message

"Syntax error converting datetime from character string"
0
 
chapmandewCommented:
select
(convert(varchar(10), TRANS_DT, 112) +Customer_Name) as key_combo
from
table_A
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

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

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