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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to find a specific format of a string

Author  Topic 

Antonio
Posting Yak Master

168 Posts

Posted - 2007-06-13 : 09:35:57
Greetings,

One of my database objects has a column that contains what we call a P number.

The format is AAA123456. That is 3 (A-Z) characters then 6 numbers (0-9). Some P number might have a gap between the characters and the numbers. For example AB 128642 or B 539447 etc..

I want to search for this kind of patters but why doesn't this work ?


like '[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ][0123456789][0123456789][0123456789][0123456789][0123456789][0123456789]'


Your help would be appreciated!

_________________________________________________________________________________________________________________________
Inability is a disaster; patience is bravery; abstinence is a treasure, self-restraint is a shield; and the best companion is submission to Divine Will.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-13 : 09:40:53
try
like '[A-Z ][A-Z ][A-Z ][0-9][0-9][0-9][0-9][0-9][0-9]'

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Antonio
Posting Yak Master

168 Posts

Posted - 2007-06-13 : 10:12:21
quote:
Originally posted by spirit1

try
like '[A-Z ][A-Z ][A-Z ][0-9][0-9][0-9][0-9][0-9][0-9]'

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp



Spirit thanks mate.

_________________________________________________________________________________________________________________________
Inability is a disaster; patience is bravery; abstinence is a treasure, self-restraint is a shield; and the best companion is submission to Divine Will.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-13 : 10:37:02
you're welcome

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-13 : 10:45:50
quote:
Originally posted by spirit1

try
like '[A-Z ][A-Z ][A-Z ][0-9][0-9][0-9][0-9][0-9][0-9]'

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp



I don't think that will help you find out values with gaps.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -