Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concat a text string gives space between??

Status
Not open for further replies.

scottyjohn

Technical User
Nov 5, 2001
523
GB
Hi all,
I am running the following sql to convert a decimal string to hex and its fine but I then need to compare that value to a different data source which already has the value in hex.  Trouble is the second source appears to have two have two zeros at the start of each hex string, so I figure I need to manually add these to the start of the converted string.

Code:
SELECT 
EMPLOYEE_ID, PLACE, STATUS, STARTDATE, STARTT, ENDT, DURATION, CONCAT('00',TO_CHAR(CONNID,'XXXXXXXXXXXXXX')) 
FROM SOF.V_STATUS WHERE EMPLOYEE_ID ='Mouse_M_34317' 
AND STARTDATE='25/06/2009'

The issue I have is that when I do this, the result of the CONNID field is '00 7201B0CE7DA7EE' and the space at the start will cause me a problem.  If I reduce the X's in the TO_CHAR statement by one, the I get this result '00###############' which I believe is because I havent specified enough characters in the to_cahr statement.

Im not sure what I am doing wrong and how to get rid of that strange space which appears?

John
[smile]
 
Sorry, but the functions you use aren't ANSI, so, please, post in a forum related to your SQL dialect.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top