Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Passing Dates to SQL From Excel

Thanks Jamie, I will try and work with this on Monday..
THanks alot. DBAL



-----Original Message-----
"DBAL" wrote ...

I need to have the user enter a starting date
and an ending date to pass to the SQL server for
retrieving invoices.

I tried to convert the invoice date to a string for
comparison with my variables but it didn't work.


My preferred approach is to store in memory as a VBA

Date type and use
an unambiguous date string in sql code e.g.

WHERE MyDateCol BETWEEN
'01 JUN 2004' AND '30 JUN 2004'

This SQL statement will be embedded in the VBA behind
Excel...


My preferred approach is to use a stored procedure e.g.

CREATE PROCEDURE
MyStoredProc (
start_date DATETIME,
end_date DATETIME
)
AS
SELECT
RefID,
DateEffective,
Earnings
FROM
EarningsHistory
WHERE
DateEffective
BETWEEN start_date AND end_date;

and call it from Excel using e.g.

EXEC MyStoredProc '01 JUN 2004', '30 JUN 2004'

Jamie.

--
.

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
Passing Dates criteria in MS Query Jim Thomlinson Excel Discussion (Misc queries) 1 April 1st 08 07:06 PM
passing dates in a conditional sum(if) Neophyte New Users to Excel 2 March 31st 07 05:35 AM
Passing Excel Info To Visio Rob Excel Discussion (Misc queries) 0 January 10th 07 08:25 PM
passing excel certification infancy9 Excel Worksheet Functions 1 April 21st 06 07:08 PM
Passing a parameter to Excel keepitcool Excel Programming 3 August 13th 03 03:57 AM


All times are GMT +1. The time now is 01:16 PM.

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

About Us

"It's about Microsoft Excel"