SQL Apprentice Question
I am looking to write a stored procedure that uses a string inside the
IN statement but am having trouble with the syntax.
Create Procedure spMyProcedure
SELECT * FROM books WHERE bookID IN(@bookID)
I've tried this and it does not work. How would I pass in a comma
separated string so that the IN clause works?
>> I am looking to write a stored procedure that uses a string inside the IN statement but am having trouble with the syntax. <<
No, you are having trouble with the most basic programing concepts --
not just SQL, but the most basic programing concepts. You have no
1) What a parameter is
2) How a compiled language works
3) What First Normal Form is and why it is important (okay, this is SQL
and not MVDBMS)
Do not feel like the Lone Ranger. This error is posted a few times a
month along with EAV, OTLT, MUCK and RTFM. Those misconceptions about
the RDBMS have names, which makes them easier to handle and to Google.
I propose a contest for a name for this piece of non-RDBMS disaster. I
will start with "NFNF parameters" of NFNFP for short. but it does not
flow off the tongue; can someone do better?