SQLTeam.com | Weblogs | Forums

SQL statement with parameter to worksheet cell value

SQL novice here

I had a working Excel workbook with ODBC data connections to an SQL Server database. Each table updated their data from connections based on a parameter from a cell value selected from the list.

“SELECT * FROM Database.dbo.Employees Emp WHERE Emp.LastName=?”

I copied the workbook to try on another server with a different server name (which I updated) and everything else the same. Kept ODBC as connection type with new connection string. Each of the data connections were looking for a connection file (.odc). Updating the connection type to OLEDB seems to fix this. Now the connection parameter referencing the cell range is not seeing the value. The connection properties parameter for each list the correct sheet and cell reference and refresh when changed is selected, but state there is no value. Is the “?” still appropriate for a parameter or is there a way to reference the worksheet cell in the SQL syntax?