Gossamer Forum
Home : General : Databases and SQL :

Help with SQL statements in Access

Quote Reply
Help with SQL statements in Access
I'm doing some data conversion from a AS400 mainframe to an SQL database. They data comes to me in a text file and I have to import it into access to work with it. The data I have needs to be broken up into several different tables and formatted so I can import it into the SQL database. Starting off, all the data is in one table due to how it is handed to me. The telephone number is broken up into three individual fields: area code, prefix, and suffix. How can I formulate an SQL select statement to put these three fields together as one field?
Quote Reply
Re: [worldchanger] Help with SQL statements in Access In reply to
I *think* you can use CONCAT for this.

eg...

INSERT INTO your_table full_number = CONCAT(part1, part2, part3)
Quote Reply
Re: [Paul] Help with SQL statements in Access In reply to
CONCAT is not a valid expression in Access. I'm trying to do all the dirty work in Access before I import it, but I may have to import it then work with it in SQL.
Quote Reply
Re: [Paul] Help with SQL statements in Access In reply to
I figured it out finally!!

SELECT [phone area code] & '' & [phone prefix] & '' & [phone suffix] AS phone_number
FROM [Active Vendors];
Quote Reply
Re: [worldchanger] Help with SQL statements in Access In reply to
Sorry my fault I was thinking you'd imported into mysql and wanted to do the join there Blush