Solved

tsql select field contain like MO TU WE TH

Posted on 2012-12-25
1
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

728 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