[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 856
  • 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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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