Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2010-01-05 : 16:43:24
|
| i have varchar field name customer value where the values are in this manner123232itemxxx2345612344item...how can i get to select only the fields with integers....ie. just 1232322345612344thanks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2010-01-05 : 18:53:35
|
| thank you so much |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2010-01-05 : 23:33:30
|
| Hi Try this is alsodeclare @a varchar(40),@start int, @end int ,@number varchar(1024), @sting varchar(1024),@var varchar(1)select @a = '12ads235'SELECT @end = datalength(@a),@start = 1 ,@number = '',@sting = ''while ( @start <= @end)BEGINSELECT @var = substring(@a,@start,1)IF isnumeric(@var) = 1 SET @number = @number+@varELSE SET @sting = @sting+@varSELECT @start = @start+1ENDselect @number as Number ,@sting as string |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-06 : 03:26:09
|
quote: Originally posted by Nageswar9 Hi Try this is alsodeclare @a varchar(40),@start int, @end int ,@number varchar(1024), @sting varchar(1024),@var varchar(1)select @a = '12ads235'SELECT @end = datalength(@a),@start = 1 ,@number = '',@sting = ''while ( @start <= @end)BEGINSELECT @var = substring(@a,@start,1)IF isnumeric(@var) = 1 SET @number = @number+@varELSE SET @sting = @sting+@varSELECT @start = @start+1ENDselect @number as Number ,@sting as string
check the link posted earlierisnumeric is not fully reliable |
 |
|
|
|
|
|
|
|