www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  ODBC    Howto convert column of datatype integer to text in select statement?
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
MF
Posted
I'm trying to concatenate a hardcoded string and an integer column in a select statement.

SELECT 'Record number is: ' + Record_Number FROM Records
WHERE (Record_Number = ?)

However, I get an error "Invalid Operand for operator: +".

I figure the solution is to convert the Record_Number column to a string but I can't figure out how. Is there a way to convert the integer column to a string so the contatenation will work?

In SQL I can write a query like this which works.

select 'record number is: ' + CONVERT(varchar(30),record_number) AS SomeText from records

What is the equivalent to use with the ODBC driver?
 
Posts: 6 | Registered: Tue August 21 2007Reply With QuoteEdit or Delete MessageReport This Post
MF
Posted Hide Post
I figured it out

select 'record number is: ' + {fn CONVERT(record_number, SQL_VARCHAR)} AS SomeText from records
 
Posts: 6 | Registered: Tue August 21 2007Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  ODBC    Howto convert column of datatype integer to text in select statement?