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 |
Ratz03
Starting Member
27 Posts |
Posted - 2015-02-05 : 11:35:40
|
Source Table Policy Number1234567890898765432134bghtyukn765kjkjjkiumlo12345678uyt98765678oooi want only policies that follow format of first eight chars are alphbet and next 3 digits to be in my output. I have tried using the substring, like, charindex functions but it's not working. Please suggest how this can be done.Thanks |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2015-02-05 : 11:45:28
|
[code]-- *** Test Data ***CREATE TABLE #t( Policy_No varchar(20) NOT NULL);INSERT INTO #tVALUES ('12345678908'), ('98765432134'), ('bghtyukn765') ,('kjkjjkiumlo'), ('12345678uyt'), ('98765678ooo');-- *** End Test Data ***SELECT *FROM #tWHERE Policy_No LIKE '[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9]';[/code] |
|
|
|
|
|