Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
soniyakapoor03
Starting Member
11 Posts |
Posted - 2010-05-17 : 04:00:18
|
| Hi,I have some doubts in sql select.I need to select fname from the table where ID is 2.My table structure is like thisFname, ID(nvarchar(30))kpn 2 jkm 3mgr 2,3krr 5I need to select only columns having ID is 2 final result should be Fnamekpn mgr I tried with split function. but not workingPlease help.Thankssoniya |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-05-17 : 04:15:16
|
If you are using SQL Server 2005 ?select t.Fnamefrom yourtable t cross apply dbo.CSVTable(t.ID) iwhere i.numberval = 2 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-17 : 11:43:58
|
| [code]select t.Fnamefrom yourtable tWHERE ',' + t.ID + ',' LIKE '%,2,%'[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|