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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concantenating Fields

Status
Not open for further replies.
Joined
Dec 11, 2009
Messages
60
Location
US
I have 3 fields that I want to print out as (M-3-0)

w.filingstatus+'-'+w.allowances+'-'+ w.exempt

I keep getting error:
Syntax error converting the varchar value 'M-' to a column of data type tinyint.

What am I missing here?

Thanks!!!
 
All of these fields should be the same type and that type should be n/var/char. If they are not you should convert explicitly these which are not.
Code:
--- Assuming that filingstatus is varchar already
w.filingstatus                   +'-'+
--- Assuming that allowances is tinyint
CAST(w.allowances as varchar(10))+'-'+
--- Assuming that exempt is tinyint
CAST(w.exempt as varchar(10))



Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top