Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Required data entry SixBowls Excel Discussion (Misc queries) 6 November 4th 09 02:23 PM
Required data in one sheet Junaid Excel Worksheet Functions 4 November 26th 08 11:18 AM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
Data manipulation help required ! gramsey Excel Worksheet Functions 4 December 11th 04 03:36 PM
Set an Access field "not" required w/ADO Raj Excel Programming 0 December 31st 03 12:15 AM


All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"