[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Substring in t-sql

Asked by Putoch in Databases Miscellaneous, SQL Query Syntax, MS SQL Server

Tags: substring

Hi There,
I had asked a question related to something like this before but never got to the bottom of it. I am hoping someone can help me this time.

I have a text field with in this field there id information on when a bill date was chaged 'from what' , 'to what'
I want to be able to do a substring on this field to pull out the data needed.
At the moment i am doing the folliowing:

SELECT *,SUBSTRING(history_text,298,2)
from customer_history where customer_id = 24829
AND  history_text like '%<b>BILLING INFO CHANGE</b>%'
AND history_text like '%Bill Day%'

The text is automatically entered into the database the one problem i am having is if i want to just bring back the date and not the text around it then i want just 2 charcters back, however if the date is from the 1st to the 9th this is throwing the formula out.

For example here are two text fields:
Create table customer_history
(history_id int not null,
customer_id int not null,
date_entered datetime not null,
history_text text not null)

Insert into customer_history values (1004963,24829,      '2007-06-07 15:48:42.000','<b>BILLING INFO CHANGE</b><br><table border=1 cellpadding=0 cellspacing=0><tr><td height=3></td></tr><tr><td width=3></td><td bgcolor=#e6e6e6>&nbsp;</td><td bgcolor=#e6e6e6>TO</td><td bgcolor=#e6e6e6>FROM</td></tr><tr><td width=3></td><td>&nbsp;Bill Day&nbsp;</td><td>&nbsp;25&nbsp;</td><td>&nbsp;17&nbsp;</td></tr><tr><td width=3></td><td>&nbsp;Tax Exempt Expiration Date&nbsp;</td><td>&nbsp;06/2007&nbsp;</td><td>&nbsp;12/1999&nbsp;</td></tr></table>');

Insert into customer_history values (1002583,12345,'2007-06-07 15:48:42.000','<b>BILLING INFO CHANGE</b><br><table border=1 cellpadding=0 cellspacing=0><tr><td height=3></td></tr><tr><td width=3></td><td bgcolor=#e6e6e6>&nbsp;</td><td bgcolor=#e6e6e6>TO</td><td bgcolor=#e6e6e6>FROM</td></tr><tr><td width=3></td><td>&nbsp;Bill Day&nbsp;</td><td>&nbsp;7&nbsp;</td><td>&nbsp;4&nbsp;</td></tr><tr><td width=3></td><td>&nbsp;Sales Rep&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;User, Legacy&nbsp;</td></tr></table>');


With my syntax i am getting back with on the correct results ie(25) but with the other i am getting back (&n).
can anyone tell me what why to write the syntax to retrieve only the 25 and the 7?
All help appriciated,
Kind Regards,
Elaine
[+][-]08/29/07 04:15 AM, ID: 19790066Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 04:19 AM, ID: 19790082Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 04:49 AM, ID: 19790266Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 05:04 AM, ID: 19790357Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 05:08 AM, ID: 19790381Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 05:10 AM, ID: 19790394Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 07:10 AM, ID: 19791413Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 07:16 AM, ID: 19791495Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 07:41 AM, ID: 19791731Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 07:44 AM, ID: 19791759Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 07:51 AM, ID: 19791832Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 08:08 AM, ID: 19792049Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 08:13 AM, ID: 19792104Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 08:15 AM, ID: 19792123Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Databases Miscellaneous, SQL Query Syntax, MS SQL Server
Tags: substring
Sign Up Now!
Solution Provided By: messen1975
Participating Experts: 3
Solution Grade: A
 
[+][-]08/29/07 09:26 AM, ID: 19792844Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08/29/07 09:27 AM, ID: 19792860Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 09:30 AM, ID: 19792880Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 09:31 AM, ID: 19792884Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08/29/07 10:29 AM, ID: 19793404Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 10:37 AM, ID: 19793476Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 10:54 AM, ID: 19793650Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/29/07 10:55 AM, ID: 19793669Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/29/07 11:00 AM, ID: 19793712Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628