AWS RDS SQL Server Cross Database Query - sql-server

I am trying to compare SQL Azure vs AWS Sql server. SQL Azure clearly lists the limitation . I am trying to find the same on AWS SQL Server. My applicaiton currently uses cross database query. Which is not supported by Azure. Is AWS RDS Sql server supports cross database query?

I had exactly the same question and decide just to have a go and see, the short answer is yes you can.
Basically you start up a SQL server instance in which you can create multiple databases and query across them as you would in any other standard SQL server instance

Yes you can!!
You can do cross database query in AWS SQL Server Instances. I'm doing cross database query with aws sql server instances for 2+ years now.
The following is the syntax
[Database_name].[Schema_name].[Table_name]
Example
Select u.[UserName], a.[Balance] From [db_detail].[dbo].[user_details] as u
INNER JOIN [db_account].[dbo].[acount_overview] AS a ON a.UserID = u.[UserID];

Related

SQL Server query in Delphi joining a table on a linked server

I have a SQL Server database that was recently moved to Azure. I have created a linked server in the local SQL Server to the Azure database. I can run the query in SQL Server Management Studio and it returns the the data I am expecting. When I run this query in my Delphi app I get an error.
Error: Reference to database and/or server name '...' is not supported in this version of SQL server.
Example of the query I am trying to run.
Select t1.field1, t2.field2
from <linkedserver>.<database>.<dbo>.<table1> t1
join <localserver>.<database>.<dbo>.<table2> t2 on t2.id = t1.id
you must use Native Client for Provider connection type.

How to know if SQL Server is in the cloud or on premises?

I recently joined in new job, they are using Azure SQL Server. Initially I don't know that SQL Server is in Azure. I am wondering how can I know whether SQL Server is in Azure or on premises?
Execute the query:
SELECT ##VERSION
The result will tell you if you are using Azure SQL Database or any other version/edition
** If you are talking about SQL Server on Virtual machine in the azure, then this is the same as local version/edition

Any options to connect from Azure SQL Server database to an Azure Data Warehouse instance

We want to be able to query the Data Warehouse database from the SQL Server database both with the same server name in Azure. Select statements including the database name (e.g. select * from server.dbo.product) returns with error that a reference to the database and/or server name isn't supported in this version of SQL Server. There are articles on creating an external data source in the SQL Server database but we get error that the credentials don't have permission to perform this action.
Azure SQL (as of Azure SQL V12 in late-2016) does not support cross-database queries the same way that they do with a normal on-premises SQL Server (e.g. using the DatabaseName.schemaName.TableName syntax).
Given that Azure SQL and Azure Data Warehouse databases each reside in different physical servers it wouldn't work anyway, as the above syntax is intended for databases that all reside in the same server.
Azure SQL does support cross-database calls via the EXTERNAL DATA SOURCE feature, which we have in normal on-premises SQL Server already. This is documented here: https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/
Note that performance won't be that great and you might be better-off doing the querying in your application code. For example complex JOINs which reduce data will run suboptimally.

Azure SQL get data from another non-Azure sql server using Linked Server

We have two SQL Server Database (EG: DB1 & DB2) that are hosted in NON-Azure environment (dedicated server). We are planning to migrate DB1 to Azure SQL.
Is there way the Azure SQL DB1 can talk to non-azure DB2 using Linked Server approach? I want to query in my Azure SQL (DB1) and get the data of DB2.
If I understand correctly you are trying to connect your Azure-db (DB1) from an on-premise db (DB2). From on-premises SQL Server, you can use linked servers and 4-part names to point to a database in Azure SQL DB using a datasource which would look like this -
[YourAzureServerName#database.windows.net].[YourDatabaseName].[YourSchemaName].[YourTableName]
For more details please check this link.
Yes you can certainly do that.
This atricle explains all the details that you need to do to accomplish that:
https://www.mssqltips.com/sqlservertip/3630/connect-an-azure-sql-database-to-an-onpremises-sql-server/
Note that your SQL Azure instance needs to be in "Standard" service tier to be able to do that.
If you want to add your SQL Azure server as a linked server to your on-prem SQL you can use ODBC connection.
Bellow MSDN article will help you with that:
https://blogs.msdn.microsoft.com/sqlcat/2011/03/07/linked-servers-to-sql-azure/

Connect to MS SQL server from PL/SQL Developer

I have PL/SQL Developer installed on my machine.
Version:-7.1.2
I want to connect to MS sql server from PL/SQL Developer. I have SQL server address, username and password with me.
I tried to search for the solution every possible way.
Can anybody help me with this?
You cannot. Directly from their web page (emphasis mine):
PL/SQL Developer is an Integrated Development Environment that is specifically targeted at the development of stored program units for Oracle Databases.
To connect to MS SQL Server from your desktop you need SQL Server Management Studio (free), Azure Data Studio (free), Toad for SQL Server ($$$), or another client that advertises connectivity to SQL Server.
open sql server from server objects add a linked servers to oracle
add stored procedure that will insert into the table in oracle and reads from sql table.
example:
INSERT INTO OPENQUERY (ERPTEST, 'SELECT EMPLOYEE_ID,FIRST_NAME FROM EMPLOYEE')
select Employee_Number,Full_Name_1 from [EmpDB].[dbo].[EMPLOYEES];

Resources