June 25, 2015 at 2:51 pm
Hi, all
How can I do this in TSQL, there are alot of wild chars but I could not find how to count them, in case below I only want id =1 and 2
this sql is not correct yet... just for idea
THanks much
Mar
DECLARE
@a VARCHAR(22) = ' alpha1234 qwerew', @b-2 VARCHAR(22) = '3456_Bravo', @C VARCHAR(22) = ' only_three123_Delta'
--SELECT 1 id, @a c UNION select 2 id, @b-2 c UNION SELECT 3 id, @C c
SELECT * FROM
(SELECT 1 id, @a c UNION select 2 id, @b-2 c UNION SELECT 3 id, @C c) b
WHERE c LIKE '%[1_3]%'
June 25, 2015 at 3:15 pm
mario17 (6/25/2015)
Hi, allHow can I do this in TSQL, there are alot of wild chars but I could not find how to count them, in case below I only want id =1 and 2
this sql is not correct yet... just for idea
THanks much
Mar
DECLARE
@a VARCHAR(22) = ' alpha1234 qwerew', @b-2 VARCHAR(22) = '3456_Bravo', @C VARCHAR(22) = ' only_three123_Delta'
--SELECT 1 id, @a c UNION select 2 id, @b-2 c UNION SELECT 3 id, @C c
SELECT * FROM
(SELECT 1 id, @a c UNION select 2 id, @b-2 c UNION SELECT 3 id, @C c) b
WHERE c LIKE '%[1_3]%'
I'm not understanding what you want. Why do you want id = 1 and 2 but not 3?
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
June 25, 2015 at 3:37 pm
I think I figured out what you're looking for.
Try changing the where clause to:
WHERE c LIKE '%[0-9][0-9][0-9][0-9]%'
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
June 25, 2015 at 4:02 pm
Thanks ALvin!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply