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 |
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2009-08-06 : 01:45:44
|
| Dear all, Here i'm refering 2 sql query for example using like function in the below sql query but i'm not getting result because there is some space in second query in Long_name string but both string are same. And in database value is LONG_NAME = FIDELITY INDIA GROWTH.if i'm executing 1st query then getting result but when executing second query i'm not geting any result coz before GROWHT extra space is there.so anybody can suggest me to solve this problem .Ex:1) Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE 'FIDELITY INDIA GROWTH%'2) Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE 'FIDELITY INDIA GROWHT%'And I tried following query also,2) Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE '%FIDELITY INDIA GROWHT%'thnksHarish |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2009-08-06 : 02:00:43
|
Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE 'FIDELITY_INDIA_GROWTH%' Hope can help...but advise to wait pros with confirmation... |
 |
|
|
kidoist
Starting Member
1 Post |
Posted - 2009-08-06 : 02:09:03
|
| oj |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-06 : 02:12:43
|
quote: Originally posted by kidoist oj
What do you mean?MadhivananFailing to plan is Planning to fail |
 |
|
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2009-08-06 : 02:28:59
|
| Hi,I am having in database table two field as LONG_NAME and M_SCHEME_ID and in that value is LONG_NAME = FIDELITY INDIA GROWTH and M_SCHEME_ID = 2.Now i want M_SCHEME_ID from table where LONG_NAME is FIDELITY INDIA GROWTH. So for that i have written following queary,Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE 'FIDELITY INDIA GROWTH%'But some times happened this LONG_NAME haveing more space between words like FIDELITY INDIA (Space is here) GROWTH. Means see following queary,Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE 'FIDELITY INDIA (Space is here) GROWTH%'So i am not able to fetch that M_SCHEME_ID coz my LONG_NAME is not matching. Means like function not working.So i want to match this, can anybody suggest me how to solve this problem ?thnks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-06 : 02:41:17
|
LONG_NAME LIKE '%FIDELITY%INDIA%GROW%' N 56°04'39.26"E 12°55'05.63" |
 |
|
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2009-08-06 : 02:46:48
|
| Hi,But i am useing through .Net application. I used following queary,pStrsqlSchmeInfo = "Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE '" & CitiDesc & "%'"In CitiDesc is comeing FIDELITY INDIA GROWTH.And i am also tryed as ..where LONG_NAME LIKE '%" & CitiDesc & "%' Means both side i have puts %. Therefore it is not comeing.So how to use in that queary.thnks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-06 : 02:54:46
|
pStrsqlSchmeInfo = "Select LONG_NAME,M_SCHEME_ID From M_CHANNEL_SCHEMES_GD where LONG_NAME LIKE '%" & REPLACE(CitiDesc, ' ', '%') & "%'" N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|
|
|