excel - sql query - parameters check for empty value

nicole282

New member
Joined
Jun 3, 2020
Messages
1
Reaction score
0
Points
0
Excel Version(s)
office 365
I am trying to create an excel report using sql queries.


I have a drop down box (generated via a sql query) that loads another report based on the input value.
Drop down box code:
Select null as State
UNION
Select state from tbl_States


This query generates a dropdown of available states. I added the null to allow for an empty string to return all records.


Query for Report:
Select columns
from tables
where tbl_states.State = ? or isnull(?,'') = ''


I am receiving an error: string data, right truncation


any ideas how else to write this to get the results I need?
I don't have access to create stored procedures or anything...
 
Back
Top