Solved

tsql select field contain like MO TU WE TH

Posted on 2012-12-25
1
443 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 69

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

679 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