SQL Server tracking changes in data coming from Oracle link - sql

I have a SQL Server table that I create by selecting from an Oracle view using a database link. The Oracle database is fully wrapped and comes from an external vendor.
The table has a text field for the current month's update. It doesn't have any dates or IDs. When I run the procedure to get the data I don't have any idea if the value has been the same for the last few months or had been updated, I have no idea when it was updated. I thought of going through the query row by row and detecting if the value is there and if it isn't, insert a new row with a creation date. This will provide a monthly row with any updates, keeping the older updates linked to the correct date. Maybe. I'm no expert and couldn't think of a way. Would this break? How would you solve my problem?
I don't have DBA rights in any databases.

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.

How to update database table with table in SQL

I have a SQL Server table with columns including Ticket id, and each row corresponding to one ticket.
Weekly, I will pull data with the same columns with rows corresponding to all tickets that have been created or changed since the last pull.
My question is, what is the correct SQL command to update my existing table so that the new tickets are added and the changed tickets are updated?
Apologies, I am new to SQL. I will be using pyodbc in python with a db in SQL Server.
Edit: Ok, for anyone still looking at this, my question becomes: how can one upsert/MERGE a large json to sql server table using pyodbc?

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.

Best way for block SQL table records in SQL Server

I have SQL Table in SQL Server like this:
In this table there are old records (Last year).
I should use this table again.But old records to be blocked (No operation taken on them (Select,Update, Delete)).
I can't modify design table and add another field like locked or date or add new table for handle operations.
Is this possible in SQL Server?
It would be very helpful if someone could explain best solution for this problem.
Thanks.

Creator of a column - SQL Server

How to find the creator of a column in SQL Server?
I checked sys.column table but only getting the created and modified date. With these two fields I also need the Creator of the column.
By Creator I mean the userid which is used to login to sql server.
Possibly you can not but if you change the column recently than you can try to find it in the below way
This report provides a history of all committed DDL statement executions within the Database recorded by the default trace.