Is it possible using t-sql, to create a stored procedure where you query a remote database using an ODBC data-source in the stored procedure? - tsql

Is it possible, using t-sql, to create a stored procedure where you query a remote database using an ODBC data-source in the stored procedure?
I have a server with an ODBC data-source.
I use via Power Bi successfully. I would like to create a stored procedure to query the remote database using the stored procedure with the odbc data-source.
I have looked at opendatasource command, but it only uses OLE DB connections.
Thanks in advance for your time.
Dean-O

Thanks all, Tim Mylott, we got it to work, had to use the ip address of the remote server but the rest of the info given above was correct. from statements needed to include the linked_Server_Name dot DB_Name dot schema dot table_Name

Related

Can't edit and execute store procedure direct from squirrel-sql client

PostgreSQL 9.6
squirrel-sql-snapshot-20220608_2238
I success connect and execute sql queries. Nice.
But when I open source of store procedure I can't modify it and can't execut it.

DB2 Z/OS - Revalidate UDF and Stored Procedure

On DB2 AIX I can use the SYSPROC.ADMIN_REVALIDATE_DB_OBJECTS stored procedure to revalidate all Stored Procedures and Functions defined in my schema.
How can I do the same thing on DB2 z/OS (v.12)?
Thanks
REGENERATE automatically rebinds, at the local server, the package for the SQL control statements for the procedure and rebinds the package for the SQL statements that are included in the procedure body. If a remote bind is also needed, the BIND PACKAGE COPY command must be explicitly done for all of the remote servers.
ALTER PROCEDURE SCHEMA.NAME_SP REGENERATE ACTIVE VERSION;
For the moment I have not found anything that automatically revalidates/regenerates all Stored/UDFs of a Schema.

Connecting SAS 9.2 with Amazon Redshift

I need to create reports/summary tables on Redshift using SAS. My client data is on Amazon Redshift and he provided me all credentials to access the database. I have SAS 9.2 (32bit) and downloaded PostgresSQL 32bit driver to my system (as Redshift is based on PostgresSQL). I setup ODBC data source successfully and now I am connecting SAS using below command:
LIBNAME RdSft ODBC DSN='Redshift server' user='xxxxxxx' pw='xxxxxx';
data Rdsft.new_table;
set Rdsft.old_table(obs=10);
run;
I am able to connect and can see contents of tables on Redshift but not able to make any table there. Sometimes I could but its taking hours to create a table just with 10 observations. Someone suggested me to use DbVisulizer to do this task but I am comfortable with SAS only.
Please suggest.
If you have SAS/ACCESS try using the postgres engine for the library instead of going via ODBC eg:
libname RdSft postgres server="<server-address>" database=<db-name> port=5432 user='xxxxxxx' pw='xxxxxx';
Also, try adding conopts="UseServerSidePrepare=1" to the libname as suggested by this article: http://support.sas.com/kb/52/585.html
The simple fact of the matter, is that when you're connecting to Redshift via ODBC, even your simple data step query:
"data Rdsft.new_table;
set Rdsft.old_table(obs=10);
run;"
Is essentially translating to "select * from rdsft.old_table" before the obs subset is getting applied.
The SAS/ACCESS postgres solution is solid, you may also want to use proc sql, select only the columns you want, and subset as much as possible. Proc Sql will translate a bit easier into Redshift query language through an ODBC than the data step will.
SAS will hopefully be issuing a SAS/ACCESS for REDSHIFT option sometime soon! :)

Can firebird database connect to other databases using like linked server in SQL Server?

I know that SQL Server has linked server that allow it to connect to other database and execute query. Now I am using firebird. I wonder if firebird has its "linked server" to access other databases. Thanks!
Firebird doesn't have a linked server feature. There is a limited method for accessing other Firebird databases (either remote or locally) using EXECUTE STATEMENT, however this only supports Firebird database, and you need to provide the data source information on each invocation.

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.