| Author |
Topic |
|
berr
Starting Member
9 Posts |
Posted - 2007-11-15 : 13:08:30
|
| I think I have a problem with a table in my database. When I use MSQuery I choose my data source, login to my databse and then I choose the table I want to query. The table I choose to query is "File." I add my columns and, I do not choose any filtering or any criteria. Once I hit finish, I get prompted with this: Incorrect Syntax near the keyword 'File'. Statment(s) could not be prepared.This is the only table in the database that this message comes up on, well that I have noticed so far. I can query other tables just fine but I am unable to query this one. It's strange because I log onto the server that is hosting the database and use Enterprise Manager and I am able to query the table this way. Why would it not allow me to query this specific table from my machine? |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2007-11-15 : 13:13:30
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=92681Is "file" enclosed in [Brackets] (or is that not the actual name that is producing the error?)naming any table with a key word like GROUP FILE MASTER...you get the idea is bad...Post the SQL from behind the MS Query if you can (press the SQL button in design view). I have a lot of experience fixing MS Query disasters my users here create.The error has nothing to do with your database by the way. It is an MS Query issue I believe. Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
berr
Starting Member
9 Posts |
Posted - 2007-11-15 : 13:23:36
|
| When I query the table in the Enterprise manager it is in brackets. SELECT *FROM [File] I can see how this would be bad practice. I don't know why they named it this but I guess I should have expected something like this because of the last mess they put me in. I can't push the SQL button, it won't give me an option to do that. I'll send you an email here shortly, thanks for responding again on my last post. |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2007-11-15 : 18:40:06
|
I never received an email, but there is an option to edit the query in SQL, in MS QUERY there is a button on the toolbar that says "SQL". Just paste what is there so I/we can see it. Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
berr
Starting Member
9 Posts |
Posted - 2007-11-16 : 13:31:13
|
| When I go to click your email it says it is currently disabled. We can just post on this forum though, it's ok. I understand what you mean by the SQL button, but I cannot click that button when I try to add the table "File" in. When there is another table in there for example, it looks like this.SELECT People2File.rep_uuid, People2File.Id, People2File.PeopleId, People2File.FileId, People2File.RoleId, People2File.RepresentPeopleId, People2File.RepresentPeopleString, People2File.Other, People2File.BillingRateId, People2File.Rate, People2File.IsCompany, People2File.Timestamp, People2File.UTCCreationDateTime, People2File.UTCLastModifiedDateTimeFROM Amicus.dbo.People2File People2FileI tried modifying it to this. SELECT * FROM Amicus.dbo File Filebut once I hit ok I was prompted with the same error again.When I did this though, SELECT * FROM [FILE] It pulled all the information, but it said it couldn't display a graphical representation. But then I can't add any other tables. |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2007-11-16 : 21:21:30
|
YOu would have to write out the SQL then. I am surprised you can't add the table though, but it is primarily due to the table name (odd, but understandable). Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
berr
Starting Member
9 Posts |
Posted - 2007-11-19 : 17:13:17
|
| I think I will have to exclude MS Query when using this specific table. I would just like to do it from my machine that's all. Surprisingly I finished one report that involved the [FILE] table. It is very odd and from the way it looks I don't think I will be able to use this table with MS Query, I'm sure I can manage though. I thank you for your time. |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2007-11-19 : 18:44:22
|
If you alias the file differently in MS Query it might work.Select mytable.* From [File] mytableYou should be able to then return and see it graphically to add tables. Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
|