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

Setting up Access in SQL Server: Field names with spaces

Status
Not open for further replies.

phweston

Programmer
May 8, 2003
38
0
0
Hi,
I am in the process of starting to switch over an Access Database to SQL Server. The Access DB was not origanlly set up by me, and there are Field names with spaces in the actual Field name(Example: Customer Name as opposed to having Customer_Name or CustomerName).

I tried importing the tables from Access to SQL, and it appears that these Field Names came over okay with out any issues that I can see.

Should we change these Fields names in the Access Database before importing the tables, or can we leaves the names as is?
 
If your field names have spaces in them you will need to use brackets when you refernce them. for example
SELECT Customer Name
FROM table

will fail.

But
SELECT [Customer Name]
FROM table

Will not.

I think it is a pain in the but to have to remember to use brackets all the time so I would remove them.


- Paul
- Database performance looks fine, it must be the Network!
 
Thanks.

The database we are using is a Back End Database, and the Front End(in Access) is already set up with these field names with spaces in the name. All our queries are set up using these Field Names, so we are debating whether or not we should start changing stuff.
 
I would change them. If for no other reason but just to follow SQL Server best practices.


- Paul
- Database performance looks fine, it must be the Network!
 
If you use the Import/Export wizard to move your tables (with data intact), you can specify in your Transformations tab the changes to column names. Otherwise you'll have to do the changes right before or right after the move.

Regardless of how you do it, I think you're going to have to do each one by hand.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top