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

Concatenating int values to form a computed int column

Status
Not open for further replies.

nelco

Programmer
Apr 4, 2006
93
US
Hi,

I want to create a computed column which concatenates other int column values.

Ex. The table has these columns:
ID int (computed Column), ContentTypeID int, MatchTypeID int

If the values for ContentTypeID, MatchTypeID are:
ContentTypeID, MatchTypeID
1 2
Then ID column should have the value 12

What should the expression be to get the computed column?

Thanks in advance!
 
CONVERT(VARCHAR(11), ContentTypeID) + CONVERT(VARCHAR(11), MatchTypeID)

Be aware that if you allow negative numbers, your concatenation could look like of weird. For example -1-2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top