Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

tsql select field contain like MO TU WE TH

Posted on 2012-12-25
1
Medium Priority
?
449 Views
Last Modified: 2012-12-25
I HAVE A FIELD NAME recurencerule

DTSTART:20110903T150000Z  DTEND:20110903T160000Z  RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;WKST=SA  
DTSTART:20120505T140000Z  DTEND:20120505T160000Z  RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,WE,SA,SU;WKST=SA  
DTSTART:20120907T140000Z  DTEND:20120907T160000Z  RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=FR;WKST=SA  
DTSTART:20121129T150000Z  DTEND:20121129T160000Z  RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH;WKST=SA  


i want to search for the variable like TU or WE MO FR SA SU IN THE LAST OF THIS STRING..

FROM BYDAY=TU,WE,SA,SU;  

BYDAY= xx,XX,XX,XX ;
SEARCH INSIDE THIS ONLY ?
0
Comment
Question by:afifosh
1 Comment
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 38719968
It's not completely clear. Do you want to see if a specific weekday is in the BYDAY list? In that case:
declare @ThisDay char(2)
set @ThisDay='TU'

select * from tbl where recurencerule like '%;BYDAY=%'+@ThisDay+';WKST=%'

Open in new window

0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question