Snowflake stored procedure referencing tables from different databases - snowflake-cloud-data-platform

My stored procedure resides in DEV1 database. It is referencing a table T1 from another database (DEV2).
I am getting the following error:
SQL compilation error: database 'DEV2' does not exist or not authorized
Can I reference tables that reside in different databases? If so how can this issue be resolved?
Thanks in advance

Related

What might cause the fully qualified name of a table in a SQL Server stored procedure to be overridden when executed?

A client has several SQL Server stored procedures in one database, Customer, that reference tables in another database, called MutualFunds.
Yesterday, their on-site admin made a copy of the MutualFunds database, which he named BACKUP-MutualFunds. When these stored procedures are called, the message 942 is thrown:
Database BACKUP-MutualFunds cannot be opened because it is offline.
That indicates to me that the stored procedures are attempting to query BACKUP-MutualFunds.dbo.tablename, but the table references within the stored procedures are qualified names, i.e., MutualFunds.dbo.tablename. I have never seen this before and am hoping that someone may have come across something similar.
Thanks for any insights.

'ssf.dse' Tables in SQL Server database

In my SQL Server database, I have a view which uses ssf.dse.ApplicationLog and ssf.dse.applications tables in the background.
The problem is - I can't find these tables in the database: they are not in the Tables folder, not in Views folder, or any other folder.
Did I miss something? What kind of tables have ssf.dse prefix?
ssf.dse.ApplicationLog means:
table ApplicationLog
in the dse schema
in the ssf database
So these tables are stored in a different database - that's why you're not seeing them in your own database ...

Where Physically SQL Server Stored Procedure objects stored in System

I know that SQL Server Stored Procedure Stored in Folder which is inside Programmability. But I want to know Stored Procedures Object where it is stored in physical system.
In resource database:
SQL Server system objects, such as sys.objects, are physically
persisted in the Resource database, but they logically appear in the
sys schema of every database.
They're all read only and you cannot access the resource database directly, so is all academic. Why do you want to know?
General metadata about a database objects is available in the Object Catalog Views.

"IN" keyword sql file path

While moving an app from access to sql server I have come across a keyword that is causing errors. The keyword within the query is "IN". INSERT INTO Table IN 'file path of sql server database'. Does sql server allow you to insert data using the file path within the query? I have been researching this for a few days and have come up with nothing.
Thanks
The IN keyword in Microsoft Access in this syntax allows you to specify another database file where the table is. This is equivalent to being in another database in Sql Server.
It looks like you are taking multiple Access database files and importing them into multiple Sql Server databases. Let's say you have an Access database called One.MDB and it gets some data from a table in Access database Two.MDB, and you have imported into Sql Server into databases One and Two. So you need to get the data from the other database. Sql Server uses a syntax of Database.Schema.Table (the schema by default is the database owner schema, or dbo).
So this in Microsoft Access:
INSERT INTO MyTable IN 'Two.MDB' ...
translates to this in Sql Server:
INSERT INTO Two.dbo.MyTable ...
That's assuming you are still using separate databases. If you've put it all in the same database, you just need to reference the table directly:
INSERT INTO MyTable ...

Join two different types of databases together

I have two databases, one MSSQL and the other in Access.
Right now, inside the access file, the mssql tables are set up as linked tables so queries can be written using tables from both databases. (e.g. "select * db1.table1 where db1.table1.somevalue not in db2.table1", or select into tables like that one)
These queries need to be moved into a VB.NET project, but still be linked to the access file.
I think what I am needing is a Database object that can have tables from 2 different connections, (ie the SqlClient and OleDb connections)
Is this possible? If so, how? Or do I need to rewrite the queries using loops or something?
What I would do is query your access database to get some result set and that pass that result set as a parameter to a stored procedure in your MS SQL database. You would just have to transform your results from access into XML to be passed as a xml variable as a parameter. And then in your stored procedure you can convert the XML to be a table variable and you can use it just like a regular table.
THere is no reason you can't create an MS Access .mdb with Links to your MS Access Database and your SQL Server database
Access Db #1 Contains Access Tables and Data.
SQL Db Contains your MS SQL Tables.
Access Db #2 contains links to the tables in Access DB #1 as well as links to the tables in your SQL Server Db. This .mdb files ALSO contains your query defs required by your vb.net project.
I'm pretty sure you can just connect to the Access database. All the internal objects--including the links to SQL Server tables--should be accessible to your vb.net project.

Resources