Azure SQL: Is it possible to use the view from another database? - sql

Being new to Azure SQL, I am already successfully JOINing my table with the table from the other database (by defining the CREATE EXTERNAL TABLE and the related things). However, some queries contain views from the other database, not the tables. How can I join my table with that external view? Is it possible at all? Or do I have to copy the code from the remote view and work directly with the external tables?

with create external table you can access a table or view :
take a look at
https://medium.com/#fbeltrao/access-another-database-in-azure-sql-1afc526b7ad4

Related

What is the difference between sql view and hive external table?

What is the difference between sql view and hive external table?
The question is valid
althougth Koushik Roy's comment is also true, it is possible to compare a Hive external table to a sql View
Koushik Roy's comment:
a view is a select statement, an external table is table(require physical storage). So, fundamentally two diff objects.
How I see those two objects:
SQL View -> A select statement on a physical table
HIVE External Table -> A query on a physical file
Therefore they are very similar

SQL Server : creating a table

When creating a table in SQL Server, it is created using dbo.<tableName> format.
I want to change dbo.tableName to source.tableName, as I want to import data into a source table and then cook that data.
Thanks
You are talking about schemas. If the schema source doesn't exist yet, you need to run create schema source. Once the schema exists it's as easy as create table source.tableName (...).

Is it possible to convert external tables to native in BigQuery?

I have created a table from Google Cloud Storage (filepath starts with gs://). I could not create it as native even after trying multiple times. I succeeded only after setting the table option as native. Later, I was able to query this table successfully. However, I need to do the following:
Add a column to the table
Append (union) two such external tables
Join the appended table with another external table
save the joined table in a new table so that I can later query this new table
Questions:
Since this is an external table, can I add a column? Can I save the joined table as native?
Yes, you can convert an external table (or federated source) to a native table in BigQuery.
To do this, simply read the external table using SQL and set the destination table for the results. BigQuery will then write the results of your query to a native table.

SQL Server - Same table in multiple schemas

I am creating a smaller sized database in Microsoft SQL Server 2012 to keep run data from machines. The company has production machines and R & D machines. I would like to use the same table for production and R&D with a Type field specifying what the run was for simplicity. I have two schemas (prod and r_d). The permissions for the production and r_d schemas will be different. Is it possible to create a table that belongs to more than one schema? I know you can have the same table name in multiple schemas, but this creates separate objects. I would like to have the one table object to belong to multiple schemas.
Example:
CREATE TABLE db_name.prod.r_d.table_name
Consider creating a synonym in one the of schemas, referencing the other schema table:
CREATE SYNONYM r_d.table_name FOR prod.table_name;
No, but you can create a view in each schema on to a single table that filters the rows
When you said Development and Production. You should consider using separate database and as we go separate server !
For sampling the data you could use a backup of the production database. If you don't want the dev team to have access to production data (avoid data leak), they have to generate their sample data themselves.
Using Synonym or View in your case looks like a bad and dangerous practice !

Get query of the table with all the records in it in SQL

HI I have a table in SQL. I want to create that table into another machine and get the DATA inside that table as well.
I don't wanna use the backup method because I have existing Stored Procedures in the other machine. I just want to get one table with all the records in it. ANy idea on how to do it?
Can you create a linked server on the target database and query the source database from the target?