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

Concatenation / data type conversion

Status
Not open for further replies.

LRHatBSSS

IS-IT--Management
Dec 22, 2005
17
0
0
US
Hi Folks,


For a SQL View I need to concatenate three different columns of a table and group the table by the result of that concatenation and sum a forth column on that grouping, but i cannot find the correct sintax.

I tried using just the "&" (copied the sintax from MS Access "sql" view of a query that produced the results I need), but, as I suspected, it did not quite work back on my SQL View (the columns are from different types: int, smalint and varchar).

Is there a way to achieve that? Are there commands to convert the types so I can concatenate them?

Thank you in advance for your help!

LH
 
You can use CAST. Example: CAST(number_col AS varchar(10)).

Andrea
 
Thx, Andrea.

The CAST works great but I still have to concatenate the fields after the type conversion. Any ideas on that?

Thank you, again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top