Updating a Field Value in a foreign DB's table in ms-Access using SQL - sql

Assume I have two Access files "Old" and "New" with the same structure. I want to Export (using SQL) a value from a field in "Old" db to its corresponding place in "New" db, initiating the SQL command from "Old" db.
To be more specific, the table name is "INFO", and the field name is "IBAN", and the exporting will be to the same ID value which is 1.
I googled and read some older questions in here, and found some similar request but with a key difference is that the order comes from "New" db, in other words, they are importing the value.
So, is what I am asking even possible? Thanks in advance.

Options:
set a link in OldDb that connects to table in NewDb and run an UPDATE action
VBA example, assuming the two files are on same computer C drive:
CurrentDb.Execute "UPDATE INFO IN 'C:\folder path\New.accdb' SET [IBAN]=something WHERE ID=1"

Related

How to create a database, table and Insert data into it and use it as a source in another data flow in SSIS?

I have a need to create a SQL database and a table and Insert data into the table from another SQL database . And also to use this newly created database as a oledb source in another dataflow in the same SSIS package. The table and database name are fixed.
I tried using script task to create database and tables. But when I have to insert data , I am not able to give database name in the connection manager as the database is created only in runtime.
I have tried setting ValidExternalMetaData to false, but that doesnt seems to help as well.
Any idea or suggestions on how to accomplish this will be of great help. Thanks
I think you just need two things to make this work:
While developing the package, the database and table will need to exist.
Set DelayValidation to true on the connection manager and dataflow tasks in order to avoid failures with connection tests before they are created.
use a variable to hold the new table name create and populate the using the variable then use the variable name in the source object.

Checking if a group of data exist in the sql server database

I was asked to do copy of a csv file(which resides on a server and is updated everyday) into the database but a group of 5-6 field are the parameter which will decide whether we can enter the data or not.
The condition for insertion is that if it is a completely new entry then it will be entered if it is a copy then skip that row and if it is a different entry then update the entry in the database.
Can someone help me with how can I do this? can I do if exist query but that will be a costly operation as it has to match every record? Or any SSIS activity might help with this?
you can make form this query MERGE and when matched do nothing
https://www.mssqltips.com/sqlservertip/1704/using-merge-in-sql-server-to-insert-update-and-delete-at-the-same-time/

How to stop Big Query using old schema when creating new table with the same name as a deleted one from Google Sheets

I am using a Google Sheet as the source of a table in Big Query. Since I am unable to rename fieldnames in the schema of an existing table I deleted the table and attempted to re-create it after amending the column names in the source Google Sheet. I need to keep the table name the same as I already have analysis files connecting to the table, however when I create the new table as ask Big Query to auto-detect the schema it uses the schema of the previous table. Even if I enter the new schema as text when creating the table it ignores what I enter and use the schema from the old table.
Any ideas how I get Big Query to detect the new schema from the Google Sheet whilst using the same table name as the deleted table?
Thanks in advance!
After trying this multiple times and it not working - with several tables - randomly it worked and let me create a table with the new scheme (manually). Not sure why this didn't work before as I'm pretty sure I didn't do anything differently. If anyone has any insight on what might have caused the initial errors I'd love to hear it for future reference but my current problem is solved.

HSQLDB - Check existing schema for reserved SQL keywords

After executing SET DATABASE SQL NAMES TRUE the database doesn't allow me to create, for example, a column called DAY.
Since I executed the statement on a database catalog that I had already been working on for a while I would like to know if there's a way to check an existing schema for these violations.
You can make a copy of the database and edit the .script file of the copy to change the existing statement SET DATABASE SQL NAMES FALSE to TRUE. When you open the copy, the engine will stop loading the script and report an error if it encounters a reserved name used for a database object. You can edit the disallowed names and try again until there is no error.

Suppress Access Message to Prevent Duplicate Import from Excel

I am importing data from Excel into an existing table in Access and want to suppress the below message.
I have tried using a multi field Index to import new records into the table and have also tried importing firstly to a Temporary table and then appending new records to the existing table.
However under both scenarios it still gives the below message pop up which I want to avoid the user seeing (as they could click yes by accident).
If I try SetWarnings = No in a macro, it just reimports all entries irrespective of whether they are duplicates or not so that doesn't work.
I would appreciate any help
Thanks
Don't import the Excel data, link them.
Now you have a linked table. Use that as source in a query where you join it with the existing table.
Select only linked records that are not already present.
Change the query to an append query. This query you can run as often as you like.
When a new Excel file is received, just replace the linked file with the new file.
This message will appear when trying to import data that violates an Index in the destination MS Access table. Check that your Excel column data does not violate the corresponding MS Access field index settings.
If the MS Access field is set to "Required" = Yes, Null values (empty cells in Excel) will also cause the message to appear.
That's two possibilities...