Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Combine numbers and text into one column?

Author  Topic 

Gary Costigan
Yak Posting Veteran

95 Posts

Posted - 2005-04-28 : 12:46:30
I'm trying to combine a numeric (number?) date and text to form the following: 38353SJUAGENTS.

I can convert a date column into a numeric value by this entry: CONVERT (INT (5), reportdate) = 38353.

I can then combine two text columns together:

ProfitCentersTable.AirportCode + BranchesTable.BranchCode = SJUAGENTS

When I try to combine the three I get an error:
"Syntax error converting the varchar value 'SJU' to a column of data type int."

How do you combine numbers with text?

A big "Thanks" as always to everyone on this Forum for their assistance and push in the right direction.

GC

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-28 : 12:49:44
convert int to varchar
select convert(varchar(100), CONVERT (INT, reportdate)) + 'your text'


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -