I have an Excel file linked to MS SQL Server through ADO connections. Within this file I can update data in the database. IE each row in Excel is a row in SQL Server.
Everything works great, except for some reason certain column headers in my SQL Server get written into every row of data and I'm not sure why. For example, my column header is Construction Date. What I see in every row of that column is construction date.
This problem seems to only occur from one of the Excel files I have. I have multiple Excel files accessing the same table in SQL Server but the only fields that seem to have this problem are the ones in that specific Excel file. The code is the same across all Excel files, the only difference is the users. That leaves me to assume the problem is because Excel crashes.
Anyone know why this occurs?
There is no select statement. The excel data is just a linked table to SQL server. The update statement is based on primary keys and is hard coded. The data that has changed is stored on a seperate tab and the update runs when you click a button.
Related
I have an Excel file that looks like the below
System | Status
Test OK
Test2 Down
Test3 OK
I also have a SQL server table with the same columns.
What I want is a button on the Excel sheet that once clicked, will truncate the SQL table and insert the values from the Excel table into the SQL table.
I have tried the below step but I am struggling due to my lack of understanding of developing in Excel (I am a SQL developer)
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/84725bcb-328d-4aed-8b95-d2c34dc46be4/need-to-update-sql-server-table-on-click-of-excel-button?forum=sqldataaccess
Any help would be massively appreciated!
Thanks
We have created an Excel Add-In for updating tables from Excel to SQL Server which have a Save button that will save your changes in Excel to the mapped table in SQL Server. The Add-In is built for non-technical people so it is rather straightforward to set up the spreadsheet without having to write any code.
It won't truncate the table, but there are a couple of ways to update the table which hopefully will give you the same result. Without knowing your exact use case, I would propose to either just do an update of the table from Excel if that meets your requirements, or add a timestamp column and let the Add-In write the timestamp to each updated/inserted row and then only use the last updated/inserted rows (you can also let the Add-In delete all previous rows after a new insert).
If that's of interest, you can read more here and download a free trial.
Disclaimer: I'm the founder of the company.
i would like to ask maybe basic question. My SSIS uses SQL query, result is exported to *.csv file. Everything works fine for months (sql select, sql records/results are in csv export) - but yesterday i have issue: SSIS ran without error, but in *.csv export one column was without any records(column header is in csv file, but records not) - in another columns there were records (records are from same table as missing column:(). when i ran SSIS manually again (cca 4 min after), data were in column. SSIS is deployed and run on same sever as database. my question is - if there is no error in SSIS Execution report, data flow task ran correctly, now query returns all data withou editing .... is there any chance to find what caused data loss? maybe on server log?
thank you
I have a SQL Server table with some row (max 6000). With Excel vba, I can create a query and the results can show in a sheet.
Next I can change some record in the worksheet.
After all I can make a copy from the original sheet and after some cells changed I compare all the cells and I can update in the SQL Server database only the different cells.
My question is there a simpler way to do this?
Maybe after I leave a cells the vba compare the before/after content and make an update if required?
Thanks your opinions!
This is the VBA event you should use to catch if a cell is changed:
https://msdn.microsoft.com/en-us/vba/excel-vba/articles/worksheet-change-event-excel
If you don't want to spend much time on it, I have created an Excel AddIn which updates data from Excel to SQL Server. It is a commercial product, but if it is a one time job there is a fully functional 14-day trial which you can download from
https://sqlspreads.com
I have gotten oracle database to connect to an excel spreadsheet except for 1 issue -- the excel table is not properly refreshing (i.e. a row I deleted in oracle still shows up in excel version). How is this happening? I cannot figure out how to get it to reflect the current version of the database without making a new spreadsheet and reconnecting. Even if I clear the table, My refresh data button brings back those rows that don't exist anymore
Also, I want to make a user-friendly way to add or delete rows in oracle via excel spreadsheet. So whatever I do in excel would automatically update in the oracle database. Is this even possible or am I really overreaching?
Does anyone have any ideas or tips? I'm not very technical so please dumb down any responses
So I'm using SSIS (SQL Server 2012) to upload/load some data from a dbf into a table. Basically, I'm using a For-Loop Container to read the dbfs (note: hundreds of dbfs) and put the data in the table. For the most part so far so good. However, there are a few dbfs (like 5 or 10 and automatically created by another process I have no control over) that have a slightly different schema (ie. missing a column X and has a new column Y). So I'm wondering if there is a way to make those columns "optional" or just automatically make them return NULL. Or some way to have SSIS check the two schemas and have "do the right thing".
Currently, when SSIS runs into these dbfs, it gives me The external columns for OLE DB Destination are out of synchronization with the data source columns. error.