Single Query that reflect in Different Database Engine like PSQL,Oracle,SQL - sql

Is there any tool or concept that work For the below case,
I have Table named Test in PSQL, SQL, Oracle server.IF I insert or Update or Delete the Data in a Table Test in PSQL, The result should update in the remaining SQL and Oracle. The same case when we do in SQL or Oracle.
Whatever change that happens in any DB Engine that reflects in the remaining Engine also.

Related

Retrieve records from table without timestamp column in SQL Server

I am using AWS RDS SQL Server as my DB. I have a few tables without a timestamp column and need to query those tables for data inserted within the last hour or so. I can't add extra columns, create trigger or change source in any way. Change Tracking (CT) feature of SQL server seems the way to go but I wanted to know is there any other way.

SSIS insert recrods from Oracle to SQL and even process them

Thanks for answering...
I am new to SSIS and I have below requirement:
We are getting bulk records from Oracle based on some criteria.
I need to insert all these bulk records first to an audit table in SQL server The tables has only few columns. the reason for this is we will get to know how many records in each cycle we have got from oracle and if they are pilling up what is the exact reason.
After inserting in audit table, I need to process them one by one in SQL server and at the end of processing I would be either accepting the record and inserting the entire record in SQL serever or rejecting the record in SQL server based on business condition.
Currently to implement this I have first added a Data flow task in SSIS package which selects few columns(which are required by Audit table) from the Oracle and inserts them to SQL server after conversion. Than I am again getting the records from oracle using SQL execute task and processing them one by one using for each container in sql server.
As mentioned above I am making twice the call to Oracle, I am not able to reduce this to one?
can someone please guide me how can I achieve this?
Thanks in advance.
If you have the data already in SQL (you did a bulk copy in your audit table) you can take the data from there and do the insert in the table you want.
Instead of reading the data from Oracle twice, you can use your SQL Execute Task to manipule the data in SQL. You can make the insert statement from here to the final table.

Modify the dataset format in SAS on a `sql-base` server

Usually I would use proc datasets lib= ; modify to change the format/informats of the columns in a datasets. But when I apply this syntax to a dataset on a sql-based server.
The error shows
ERROR: The HEADER/VARIABLE UPDATE function is not supported by the ODBC engine.
I found some articles that may explain the problem. Here's one. http://support.sas.com/kb/37/015.html
Moreover, whatever dataset I created in the network, the format/informat/length is changed to its 'default' setting. E.g date9. -> datetime 22.3.
But still I don't understand why it happens. Is there something pre-defined in the network and the architecture of the server is not 100% compatible with SAS?
When you modify format, You alter table.
Suppose you have some diferent database (SQL) servers. Example Oracle, MS SQL, MY SQL. All of them have their own dialect on altering table.
When You write modify column; ... you are altering table. But SAS does not which dialect to try. That is why alter table procedure is not supported from datasets procedure.
You can update that table using database server dialect, but it needs to be added from proc sql procedure. Like it was writen in that article
execute( alter table table-name ...specific-Oracle-syntax...)by oracle;
data9. I think You mean date9.. Well it is SAS format. Other database servers, can have or can have not this format. By default they will create database default formats.

Does Modifying Data in Access Table Modify Data in an ODBC-connected Oracle SQL table?

I am new to access. I am using a tool/access database someone built, and it has an ODBC connection to an Oracle SQL database in it.
There are different queries on the side panel, and some of them are delete queries.
If I run these delete queries will they just modify data in my local access database without modifying the data in the Oracle Database?
Yes these will change something in the database whether its linked with another access database table or oracle table and within the database. To review the query you can open the queries in design view and run a normal select query so you can see what the queries are deleting. You can have a normal table image and or globe with a arrow in front pointing towards the table then its linked. A lot of times when I am testing I just run select queries and then I make a copy of what I will be deleting just in case anything goes wrong.

How to do a search and replace of a part of a string in all columns in all tables in an sql database

Is it possible to search and replace all occurrences of a string in all columns in all tables of a database? I use Microsoft SQL Server.
Not easily, though I can thing of two ways to do it:
Write a series of stored procedures that identify all varchar and text columns of all tables, and generate individual update statements for each column of each table of the form "UPDATE foo SET BAR = REPLACE(BAR,'foobar','quux')". This will probably involve a lot of queries against the system tables, with a lot of experimentation -- Microsoft doesn't go out of its way to document this stuff.
Export the entire database to a single text file, do a search/replace on that, and then re-import the entire database. Given that you're using MS SQL Server, this is actually the easier approach. Microsoft created the Microsoft SQL Server Database Publishing Wizard for other reasons, but it makes a fine tool for exporting all of the tables of a SQL Server database as a text file containing pure SQL DDL and DML. Run the tool to export all of the tables for a database, edit the resulting file as you need, and then feed the file back to sqlcmd to recreate the database.
Given a choice, I'd use the second method, as long as the DPW works with your version of SQL Server. The last time I used the tool, it met my needs (MS SQL Server 2000 / 2005) but it had some quirks when working with database Roles.
In MySQL, you can do it very easily like this:
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
I have personally tested this successfully on a production server.
Example:
update users set vct_filesneeded = replace(vct_filesneeded,'.avi','.ai');
Ref: http://www.mediacollege.com/computer/database/mysql/find-replace.html
A good starting point for writing such a query is the "Search all columns in all the tables in a database for a specific value" stored procedure. The full code is at the link (not trivial, but copy/paste it and use it, it just works).
From there on it's relatively trivial to amend the code to do a replace of the found values.