carmei
carmei

Reputation: 1

SQL 2 tables area code,number , make 1 table

I have a table with 2 columns , area code and telephone number.

I am setting up a asterisk server to caller id the numbers, using Microsoft sql

I am attempting to join the tables so that asterisk recieves the number it can search ie. 7177182222 and not just the number 717 area code table 7182222 number table

Upvotes: 0

Views: 787

Answers (1)

Joseph Alcorn
Joseph Alcorn

Reputation: 2442

Try:

SELECT area_code + phone_number AS ten_digit
FROM example_table

If your types are not varchar of some sort, you will need to cast them:

SELECT CAST(area_code AS VARCHAR(3)) + CAST(phone_number AS VARCHAR(7)) AS ten_digit
FROM example_table

Upvotes: 2

Related Questions