trpnbillie
Programmer
Greetings all!
Does anybody know how to easily scan a field for a list of specific characters and then return them? I have one simple table with one field: "StringList". My table looks like this:
"StringList"
-----------
John Doe
XYZ
aeixyz
try try
I want to scan the entire "StringList" field for vowels and then report on them. For example, I want my recordset to look like this:
"StringList" "AnyVowels" "WhichVowels"
------- ----------- -------------
John Doe Yes o, e
aeixyz Yes a, e, i
I am able to do the easy part of identifying and selecting only the records that have vowels by doing this:
DECLARE @vowels varchar(1000)
SET @vowels = '%[' + char(97) + char(101) + char(105) + char(111) + char(117) + ']%'
SELECT StringList, 'Yes'
FROM MyTable
WHERE patindex(@vowels,StringList) > 1
but i don't know how to return the specific vowels for each field. (i.e. I don't know how to put values under the "WhichVowels" field in my recordset). I assume that i can report on the FIRST vowel, but is it possible to report on all vowels?
Is it not possible?
I thank you for any insight!
Does anybody know how to easily scan a field for a list of specific characters and then return them? I have one simple table with one field: "StringList". My table looks like this:
"StringList"
-----------
John Doe
XYZ
aeixyz
try try
I want to scan the entire "StringList" field for vowels and then report on them. For example, I want my recordset to look like this:
"StringList" "AnyVowels" "WhichVowels"
------- ----------- -------------
John Doe Yes o, e
aeixyz Yes a, e, i
I am able to do the easy part of identifying and selecting only the records that have vowels by doing this:
DECLARE @vowels varchar(1000)
SET @vowels = '%[' + char(97) + char(101) + char(105) + char(111) + char(117) + ']%'
SELECT StringList, 'Yes'
FROM MyTable
WHERE patindex(@vowels,StringList) > 1
but i don't know how to return the specific vowels for each field. (i.e. I don't know how to put values under the "WhichVowels" field in my recordset). I assume that i can report on the FIRST vowel, but is it possible to report on all vowels?
Is it not possible?
I thank you for any insight!