views:

78

answers:

4

MySQL uses the USE database_name to change the active database. Does that work on all databases?

EDIT: By databases I mean DBMS. Thanks for bringing it to my attention.

A: 

No. Postgres uses \c as far as i know. Also, in oracle you will need to use "alter session" command.

pinaki
A: 

No. Many T-SQL databases has the command, but not all. Simple as that.

Simeon
it works on oracle see http://www.devx.com/dbzone/Article/16393
Gambrinus
@Gambrinus i tried using USE for sqlplus and could get it working. The article you have mentioned required signing in. Can you give the info on how to get it working?
pinaki
to access the article without signing in google "oracle use database" and it should be the 2nd result
Gambrinus
Changed my answer, it was a mistake to mention any DB
Simeon
+1  A: 

on all that are using SQL as a query-language. So that includes, oracle, postgresql, ms sql-server, db2 even ms access. So I think you've got most cases covered.

edit: exclude postgresql - there you have to use \c

Gambrinus
A: 

SQLite does not recognize "USE dbname", but instead uses "ATTACH":

attach 'my.db' as mydb;
Dave Sherohman