TSQL 2008 R2- Setting a parameter condition

Hi Experts,

Is it possible to do this:
@Code AS nvarchar(20)
Set @CASE In ('15NW-N350VBE', '15NW-N350VBA ', '15NW-N350VBR')

SO I can do this:
dbo.fncASACHInvoiceItem(@Code, NULL, NULL)

Can someone show the correct way to do this?

Please help and thanks
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
No. But you can use a table-valued parameter to pass in a table of values.

What are you trying to do in your function with that?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amour22015Author Commented:
Maybe all I have to do is this:
dbo.fncASACHInvoiceItem('15NW-N350VBE', '15NW-N350VBA', '15NW-N350VBR')

Does this look correct?

Please help and thanks
ste5anSenior DeveloperCommented:
Maybe.. I don't know your functions. And none here either..
Brian CroweDatabase AdministratorCommented:
You're leaving a lot of information out and what you've provided is ambiguous at best.

In your original question is the first line of code supposed to be a variable declaration?  Is the second line supposed to be a variable assignment?  Where does @CASE come from because it is never defined?  What does the function fncASACHInvoiceItem do and what are the parameters?

If you are asking how to pass a variable list of grouped values to a function I would suggest sending them as a comma-delimited string and then splitting them within your function but a table variable may also work depending on what you have to work with.
Amour22015Author Commented:
Great thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.