Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 01:38 AM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default Select from Comma Separated Values

Hello ,

I have a table with Diagnosis as a Field and the values in it look like "90,105" , the comma separated ids are th diagnosis ids, now I want to fetch the diagnosis names from the diagnosis main table for all the values in the comma separated field Diagnosis .

please help me in this as it is very urgent requirment.

regards
sasidhar

thanks,
Sasidhar
__________________
thanks,
Sasidhar
 
Old March 21st, 2005, 04:13 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

I have a suggestion,

If you are using Stored Procedure, you can convert the filed value from "90,105" into '90','105',

Use either Exists or Inlist.


Gokulan Ethiraj
 
Old March 28th, 2005, 06:58 PM
Authorized User
 
Join Date: Mar 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if your comma seperated values are integer type then you can use exec command to get your job done

like
exec ('select whatever from Tablename where column in (' + cast(commaseperatedvalue as varchar) +')')

atul






Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a list box from comma separated values CoderNH Access VBA 3 October 20th, 2008 08:37 AM
retrieving comma separated values from column abhishekkashyap27 SQL Server 2005 6 April 21st, 2008 09:27 AM
Comma Separated values aldwinenriquez SQL Server 2005 3 June 1st, 2007 08:52 PM
Select Query for Comma separated IDs veeruu SQL Language 3 February 9th, 2006 03:17 AM
need comma seperated values in select atulmar SQL Server 2000 2 April 12th, 2005 07:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.