September 24, 2003 at 8:06 am
How do I build a string to use in the IN part of a WHERE clause.
September 24, 2003 at 8:26 am
If you've got a string, then you'll need a hack:
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm
If the data is not in a string, don't make a string for this purpose. Using it as a 1NF result set is preferable.
--Jonathan
Edited by - jonathan on 09/24/2003 08:30:58 AM
--Jonathan
September 25, 2003 at 6:50 am
Well, that all depends. You can also make a UDF (User Defined Function) that will return a Table of the Strings (one string per Row) which returns only one Column of Data.
I use this method a lot in my applications. For example "Select * From Companies Where CompanyID IN(Select * From dbo.fn_GetCompanyList(@ParentCompanyID))". Just do some research on the Functions, it's very easy.
September 25, 2003 at 10:08 am
quote:
Well, that all depends. You can also make a UDF (User Defined Function) that will return a Table of the Strings (one string per Row) which returns only one Column of Data.I use this method a lot in my applications. For example "Select * From Companies Where CompanyID IN(Select * From dbo.fn_GetCompanyList(@ParentCompanyID))". Just do some research on the Functions, it's very easy.
Exactly my point, you're using a 1NF (first normal form) result set. But it is rare to need a UDF for this, unless you're trying to use a linked list heirarchy or something. If one is looking to "build a string" on the server-side for this, then chances are excellent that just a join will suffice.
--Jonathan
--Jonathan
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply