pjandshelly

Board Regular
Joined
Jan 25, 2017
Messages
61
I am using a SQL Query with Parameters that I have connected to an excel document. I am getting an error when running the data query of:
[Microsoft][ODBC SQL Server Driver]Invalid Parameter Number. I have been able to get this report to run in the past, but having an issue now.

Below is my query:
with tv as (
select a.AppointmentDateTime, a.DataEntryStaffSID, a.AppointmentMadeDate, a.Sta3n
from appt.appointment a
where a.sta3n = 558
and a.AppointmentDateTime >= dateadd(day,-365, getdate())
and a.AppointmentDateTime <= getdate()
and a.DataEntryStaffSID in (15590949,
1202021379,
1202309708,
1202344781,
1202408942,
1202407701,
1203335029,
1204430504,
1205076023,
1206364862,
1206364864,
1206684106,
1206792953,
1206794793,
1206820287,
1206922884,
1207111900,
1020051,
836559,
10429449,
872418,
995576,
853813)
)
select b.staffName, a.AppointmentMadeDate, a.AppointmentDateTime
from tv a
join sstaff.SStaff b on b.staffSID = a.DataEntryStaffSID
where b.sta3n = 558 and a.AppointmentMadeDate >= ?
and a.AppointmentMadeDate <= ?
order by b.staffName, a.AppointmentMadeDate
;
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top