![]() |
SQL data access help required?
I've never used excel to do this before (see below), so
i'm at a complete loss abnd could use some guidance. What i've done so far.... I need to connect to an sql db and retrieve some information that populates my excel spreadsheet. In excel (2000), i've gone to "Data/get external data/New database query", i've connected to my sql server using the SQL ODBC driver, ok..this bits fine. I then create an excel query that runs some T-SQL, ok, this bits fine. e.g. DECLARE @month varchar(15) SET @month = datename(month,dateadd (mm,-1,getdate())) DECLARE @year varchar (5) SET @year = datename(year,getdate()) select count(*) from <Table where <field=@month and <field=@year if i run the query (using microsoft query) it gives me the correct values, but in my cell within excel it shoes me nothing but the name of the excel query that is running and no values? I seem to be missing something here, can anyone point me in the right direction? |
All times are GMT +1. The time now is 01:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com