Solved

convert date to text

Posted on 2008-06-09
3
846 Views
Last Modified: 2012-05-05
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
Comment
Question by:redgreenred
  • 2
3 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21745519

select
(cast(TRANS_DT as varchar(30)) +Customer_Name) as key_combo
from
table_A
0
 

Author Comment

by:redgreenred
ID: 21745607
getting the same error message

"Syntax error converting datetime from character string"
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 50 total points
ID: 21745619
select
(convert(varchar(10), TRANS_DT, 112) +Customer_Name) as key_combo
from
table_A
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now