vigilphp — 2010-11-28T22:47:40-05:00 — #1
Firstly I'm a complete newbie when it comes to mssql. I have five MSSQL databases, In all of them except one I can easily do say...
SELECT TOP 10 * FROM dt_Organizers
However one of the new databases require me to do this:
SELECT TOP 10 * FROM dbuser.dt_Organizers
Note that all the tables in all databases have "dbuser" "dbamy" "dbyon" "dbmio" "dbcana" prefixes respectively, this never caused a problem before. Now if I use the query without doing dbuser.dt_Organizers it brings up:
Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'dt_Organizers'.
r937 — 2010-11-29T02:32:04-05:00 — #2
are you using the USE command anywhere?
vigilphp — 2010-11-29T08:40:53-05:00 — #3
Not at all. I'm using mssql_query function in php... does that help? ^^'
r937 — 2010-11-29T08:53:15-05:00 — #4
the USE command is intended to select the database for the commands which follow
if you can't get FROM dt_Organizers to work, you're probably not in the dbuser database, which is why you have to say FROM dbuser.dt_Organizers
wwb_99 — 2010-11-30T16:54:56-05:00 — #5
What I think is going on is the users who create the tables are making them in their own schema, so, if you are logged in as dbuser and you do SELECT * FROM dt_Organizers you are really doing SELECT * FROM dbuser.dt_Organizers. Check out the default schema property for the users -- should tell you alot.