Declaring multiple Variables

Hello,

My company uses Dynamics Great Plains, we have over 100 individual entities each with their own DB all on the same server. I'm trying to declare multiple account numbers as variable to filter the transactions. My hope is that I can find them no matter which DB they're on. I generally have the queries running together using union all and calling each individual DB. I have it all put together in an excel file using concatenate to manage the different DB's all using the same query.

My SQL skills are fairly amateur so any help would be greatly appreciated.

Thank you,
Tristan

I found a solution. I'm using

Declare @ AccountNumbers AS TABLE (AN VARCHAR(100))
INSERT @AccountNumbers SELECT '12345'
INSERT @AccountNumbers SELECT '45678'
etc......

SELECT ...... WHERE ACCTNUM in (SELECT AN FROM @AccountNumbers)