SquirrelSQL access more databases in one SQL script - sql-server-2008-r2

It's probably a trivial question but I wasn't able to find any solution. The following script:
use Database1
go
...
use Database2
go
...
works in SQL Server Management Studio but not in SquirrelSQL 3.5.0 (jTDS Microsoft SQL driver) - use: invalid SQL statement.
What's wrong? Should I enable something in Squirrel options? (Both databases are located on the same server.)

Related

run \dt in oracle sqldeveloper for PostgreSQL

I configured PostgreSQL for Oracle SQL developer.
I just tried to run the command \dt; from the worksheet and received below error
Error starting at line : 1 in command -
\dt
Error report -
SQL Error: ERROR: syntax error at or near "\"
Position: 1
Could you please advise how to run the commonly used psql commands from worksheet in Oracle SQL developer.
Edit1:
Are there any alternative equivalent for such psql command for oracle sql developer please. Thanks.
Doesn't SQL Developer offer a GUI view that provides the same info as \dt does? That is its job, afterall, and the point of using a GUI.
You can start psql with the -E option, then it will show you the SQL it executes to get the data behind the various backslash commands. You can then capture and run those queries in something else, like (presumably, I haven't tried it) SQL Developer.
You cannot do that.
psql commands are only available in psql.
Consider using psql, it is superior.

Setting up environment for SQL queries

I know the basic syntax of queries but otherwise I'm a beginner with SQL.
I have an SQL file (.sql) and I downloaded a couple programs (pgadmin and sql workbench).
I have no idea how to get from where I am now to actually writing queries and finding information. How do I set up so I can actually import my SQL file and start writing queries?
pgAdmin is the default GUI for PostgreSQL.
SQL Workbench is a free, DBMS-independent, cross-platform SQL query tool.
Either way, you need to connect to a database to actually run queries. The DBMS can either run on your local machine or you can connect to a remote server - where you need access privileges of course.

Windows Azure - Mobile services, database connection

I'm having trouble running sql commands to my database on Windows Azure. Previously I had no problems at all running my commands and stored procedures with SQL management studio until I added another database on the same server. I can still connect and even se all the tables and both databases i SQL management studio but I cannot run any commands.
If I use the online management portal I am able to run my SQL but not with SQL management studio.
select * from nextlabel.[Article]
and it gives the folowing error:
Invalid object name 'nextlabel.Article'.
Any ideas on how to connect properly to one of the databases or if I'm doing something else wrong?

Rename SQL Azure database?

How can i rename the database in sql Azure?
I have tried Alter database old_name {MODIFY NAME = new_name} but not worked.
Is this feature available in SQL Azure or not?
Just so people don't have to search through the comments to find this... Use:
ALTER DATABASE [dbname] MODIFY NAME = [newdbname]
(Make sure you include the square brackets around both database names.)
Please check that you've connected to master database and you not trying to rename system database.
Please find more info here: https://msdn.microsoft.com/en-US/library/ms345378.aspx
You can also connect with SQL Server Management Studio and rename it in Object Explorer. I just did so and the Azure Portal reflected the change immediately.
Do this by clicking on the database name (as the rename option from the dropdown will be greyed out)
Connect with SQL Server Management Studio to your Azure database server, right-click on the master database and select 'New Query'. In the New Query window that will open type ALTER DATABASE [dbname] MODIFY NAME = [newdbname].
It's Very simple for now - Connect to DB via SQL Management Studio and Just rename as you generally doing for DB [Press F2 on DB name]. It will allow you to do this and it will immediately reflect the same.
I can confirm the
ALTER DATABASE [oldname] MODIFY NAME = [newname];
works without connecting to master first BUT if you are renaming a restored Azure database; don't miss the space before the final hyphen
ALTER DATABASE [oldname_2017-04-23T09 -17Z] MODIFY NAME = [newname];
And be prepared for a confusing error message in the Visual Studio 2017 Message window when executing the ALTER command
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
You can easily do it from SQL Server Management Studio, Even from the community edition.

How to connect to particular database in Oracle 10g

Suppose I have multiple Oracle databases in the same server. Now I want to connect to particular database and query a table just like SQL Server 2008. How to start particular Oracle database?
If you are using SQL*Plus, the most common syntax for opening a connection is
sqlplus user_name/password#tns_alias
In this example TNS_ALIAS is the TNS alias for the particular database you want to connect to (most likely "XE" based on your followups to inium's answer). If you want to connect to a different database, you would need to specify a TNS alias for that specific database.
Note that since you are coming from a SQL Server background, the SQL Server definition of a database is rather different than the Oracle definition. What SQL Server calls a database is similar logically to what Oracle calls a schema (and similar physically to what Oracle calls a tablespace). So when you're dealing with Oracle, it's much more common to have many schemas in a single database than to have a large number of databases on a server. This is particularly true if you're using the Express Edition (Oracle XE) where you're generally limited to one database per machine.
go to cmd and type sqlplus <database-name>/<database-password>
You can use SQL Developer, it's similar to SQL Enterprise Manager 2005. Just create a new connection using the db user name and password.