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 |
|
venkat_9099
Starting Member
8 Posts |
Posted - 2004-04-07 : 08:24:42
|
| Hi,I want to search from database. I have a table which have the prefixes of mobile numbers.. like "919892" and I have the mobile number as "919892123456". I want to find the prefix from the database for the given mobile number.. How can I search. I know that if the case is reverse, I can use LIKE. Venkat |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2004-04-07 : 08:43:03
|
| select * from table where columnName = substring('919892123456',1,6)He is a fool for five minutes who asks , but who does not ask remains a fool for life!<N>http://www.sqldude.4t.com |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-04-07 : 12:18:10
|
| SELECT *FROM Table1WHERE SUBSTRING(Column1, 1, 6) = '919892'ORSELECT *FROM Table1WHERE Column1 LIKE '919892%'Tara |
 |
|
|
venkat_9099
Starting Member
8 Posts |
Posted - 2004-04-08 : 02:31:13
|
| Thanks for the replies..The working query is select * from prefix_master where prefix = substring('9198202222',1,len(prefix)) |
 |
|
|
|
|
|