Why do you always forget the little things? I try to account for what users may do when using an application and add in checks and validation where I can. But something I don’t have to do a whole lot is to upload a user created Access database to our SQL Server. In my case it was a smaller Access database with just one table that I could use as some initial data for a new app. I already had a DSN setup and the Upsizing Wizard in Access actually worked pretty good to get the table structure and data up to our larger SQL database. I did have to install Access 2007 since the user used the newfangled accdb format.
However once the data was up there I saw that she had used column names with spaces. I couldn’t remember the last time I did that. The little dilemma was writing a query to move the uploaded data from its new SQL table to the nice organized and clean tables I wrote. The solution was simple, just use [] around the column names.
SELECT [Column One], [Column Two] FROM tblAccessData