SQLTeam.com | Weblogs | Forums

Excel cell data from sql query


#1

not purely a SQL question. but anyone know how I can have a cell populated by a sql query.

For example, if a user manually input a part number into cell A1, cell A2 would populate by completing a query using A1 as a parameter.

Something like:
= select table.desc from table where table.partNo = 'A1'

Hope this makes sense. Thank you.


#2

I've used MSQuery, in Excel, to do that. Not quite as simple as you describe though, sadly ...

The target cells, populated by the query (usually multiple columns, and multiple rows) have to be "refreshed", at which point the SQL Query is run - and that query can use Cell A1 as the Part Number parameter in the SQL statement.

Long time ago though, so there might be smarter ways in current versions.