I've got a basic update query that I run from SQL Server Mgnt Studio and I'd like to incorporate it into Excel so that I can type in the parameter that is needed and run it out of Excel. I've been able to incorporate "Select" SQL queries and replace the parameters in the SQL Statement with "?" to create a parameter that is linked to a cell reference, but the same procedure isn't working for an "Update" Statement.
I researched all over and it says I'll probably need to incorporate a bit of VBA Code in order to do this, but I can't quite figure out how to do this.
Here's the Connection String I have that works when I run the "Select" Query:
DSN=AvXXnte;Description=Avionte;UID=thoXXX.shXXX;Trusted_Connection=Yes;APP=Microsoft Office 2010;WSID=MAU832N;DATABASE=AvXXnte
The Command Text I would like to run is:
SET Approve = 1
FROM TimeEntryBatch INNER JOIN
TimeEntryBatchError ON TimeEntryBatch.TimeEntryBatchGUID = TimeEntryBatchError.TimeEntryBatchGUID
WHERE (TimeEntryBatch.BatchID = ?)
The "?" is normally the Parameter that is pulling the number from Cell "=Sheet1!$C$2"
Please let me know if anyone has any questions or if I can provide any other detail on how best to accomplish this task.