?
Solved

convert date to text

Posted on 2008-06-09
3
Medium Priority
?
853 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
[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
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 200 total points
ID: 21745619
select
(convert(varchar(10), TRANS_DT, 112) +Customer_Name) as key_combo
from
table_A
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

800 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