Tuesday, March 20, 2012

Converted Access database gives problems due to field names

Hi

I have been working with asp.net against an Access database (created by someone else several years ago). Now I have to move the database to run under MSSQL Server. I successfully updated it via the Access migration tool, and it's running fine under MSDE.

However, many of the fields in one table are 'named' as 'numbers' - eg 101, 102, 34 etc. Therefore SQL commands such as:

update Mytable set 101 = "test" where ID = 2

fail with Incorrect syntax near '101'.

I would never set up such a database structure myself, but I am stuck with it. Is there any way to make MSSQL commands work with this sort of naming?

Thanks for any help you can give.

LeeYou could try:


update Mytable set [101] = "test" where ID = 2

I have not tried this with fields that are all numbers, but I expect it should work.sqlsql

No comments:

Post a Comment