Saturday, February 25, 2012

Need Help?

I have a field with the name in my database called comments. In this field i have data like "zeroed out (10/21 10:37 AM - GS)CT SAID THIS CASE IS DISPOSED ALREADY (2/13 10:05 AM - CD)"

I need to get datetime that is in last braces (2/13 10:05AM - CD). how can i get this if i have multiple braces in substring function in sql server ?.

Thank you.

.substring(lastindexof( '(' ), lastindexof( ')' )|||

VB

Dim commentsAs String ="zeroed out (10/21 10:37 AM - GS)CT SAID THIS CASE IS DISPOSED ALREADY (2/13 10:05 AM - CD)"Dim startAs Integer = comments.LastIndexOf("(")Dim endingAs Integer = comments.LastIndexOf(")") - start + 1 comments = comments.Substring(start, ending)
C#
{string comments ="zeroed out (10/21 10:37 AM - GS)CT SAID THIS CASE IS DISPOSED ALREADY (2/13 10:05 AM - CD)";int start = comments.LastIndexOf("(");int ending = comments.LastIndexOf(")") - start + 1; comments = comments.Substring(start, ending); }
Just some other options|||

Thank you for your help but i want this to do in sql server.

No comments:

Post a Comment