Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 12th, 2006, 07:09 AM
Registered User
 
Join Date: Oct 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default string extracting

Hello

I looking for the solution for extracting the text part and numeric part seprately. The exact requirement is like this.

To extract first part of string till the first numeric value that is preceded by a single space.
Examples:
‘Dorpsstraat 48’ = ‘Dorpsstraat’
‘3e dwarsstraat 23’ = ‘3e dwarsstraat’
‘Singel 6-III’ = ‘Singel’
‘Dorpsstraat dwarsstraat 23’ = ‘Dorpsstraat dwarsstraat’

how do i do it? can someone help me? i'm very much thankful to you if you do so..

with thanks
Fraijo
 
Old October 16th, 2006, 11:43 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

You kinda double posted... go look at your more recent post and find the solution I posted. Then, do the opposite...

--Jeff Moden
 
Old October 25th, 2006, 04:02 AM
Registered User
 
Join Date: Oct 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi.. Jeff..

I Got the answer.. Thank you very much for helping me..

--Fraijo

 
Old October 25th, 2006, 04:03 AM
Registered User
 
Join Date: Oct 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Declare @str varchar(100)
Declare @strnew varchar(100)
declare @i as int
declare @l as int
set @str ='3 Dorpsstraat 6-III'
set @strnew =''
set @i= len(@str)
set @l= 1
while @l<=@i
 begin
 if (substring(@str,@l,1)=' ' AND isnumeric(substring(@str,@l+1,1))=1)
  begin
    print @strnew
  end
 else
  begin
   set @strnew = @strnew + substring(@str,@l,1)

  end

 set @l = @l +1
 end

 
Old October 25th, 2006, 09:53 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Quote:
quote:Originally posted by fraijo
 Hi.. Jeff..

I Got the answer.. Thank you very much for helping me..

--Fraijo

As a matter of courtesy to the other folks on this forum, would you mind posting your solution? Thanks...

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting Text Jeff Mason BOOK: Beginning Regular Expressions 1 October 24th, 2006 06:38 AM
extracting atributes - how to do this? zoreli XML 6 August 12th, 2006 03:46 AM
Extracting an Integer from a string gjc VB How-To 2 September 13th, 2005 03:50 PM
extracting last word of a string p_gauri7 Crystal Reports 1 January 3rd, 2005 09:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.