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 |
|
stoneferry
Starting Member
3 Posts |
Posted - 2008-06-24 : 07:18:22
|
| Hi, the Microsoft SQL Server version is 2000Basically I want use a basic regular expression but can't seem to get the syntax right. i want to compare ID_short = ID_LongID_short is a truncated version of ID_Long, and I want to search on the beginning only (hence I can't use the 'LIKE' comparative on it's own).What is the syntax to use Reg Expressions (or if anyone knows a non RegExp way of searching the beginning please let me know).Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-24 : 07:22:23
|
Post some examples and maybe we can show you how LIKE works. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
stoneferry
Starting Member
3 Posts |
Posted - 2008-06-24 : 07:39:53
|
| Two example IDs:ID_short- 2ACKMAID_long- 2ACKMARLIKE Cannot be used because of the potential presense of ACKMA2 ACKMAR2 etc. So searching on the beginning of ID_Long is required using ID_Short as the criteria. The truncation of the ID_Short is due to technical circumstances beyond control at present.Thanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-24 : 07:52:45
|
| try using conditionON PATINDEX(ID_short+'%',ID_long)>0 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-24 : 08:07:30
|
or using LIKESELECT *FROM TableWHERE ID_Long LIKE ID_Short + '%' E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|