Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Posts
    6

    Unanswered: Extracting a Value from string

    Dear All,

    I have a 'calculation' coulmn(datatype:test) in pr_cal table.In this coulmn a big string is stored.for eg:

    Begin Calculationis <br />\n<br simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard galley Total Price including Commission at This Level: 7.6847058823529411764705882353 the leap into is simply been the industry's standard dummy text Gross Price with Surcharges : 6.14
    It Lorem Ipsum survived not only nProduct Price including Commission: 5.68627 five centuries, but also the leap into since the 1500s, when an unknown Total Price including Commission at This Level: 17.14567335 scrambled it to make a type specimen book.Total Price including Commission at This Level: 27.6847 <br />\n<br />\nEnd Quote Calculation<br />\n"

    I need to extract the value next to 'Total Price Including Commision at this level: " here it be 7.684 and need to store in seperate column.

    Note:This "Total Price Including Commision at this level" string may occurs many time in the text. I need to get the value next to first one.

    Sorry for this example,as it need to explian bit clearly about my requirtment.Any help will be highly appreciated.

    Regards,
    SG.

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Use CHARINDEX to search for the first position of "Total Price including Commission at This Level: ", then CHARINDEX to search for the first " " beyond that, then use SUBSTRING to grab the number, then CONVERT to explicitly convert it to a usable number.
    Ken

    Maverick Software Design

    (847) 864-3600 x2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •