Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

patindex alternative in SSIS Expand / Collapse
Author
Message
Posted Thursday, August 22, 2013 11:23 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, February 3, 2014 8:56 AM
Points: 14, Visits: 34
i need to implement the below code in ssis.

declare @value nvarchar(200);
set @value='EN 60325';
WHILE @Value LIKE '%[^0-9]%'
SET @Value = REPLACE(@Value, SUBSTRING(@Value, PATINDEX('%[^0-9]%', @Value), 1), '')
select @value

output-> 60325
Mainly i need alternative to patindex.
Thanks in advance!
Post #1487424
Posted Thursday, August 22, 2013 1:30 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:17 AM
Points: 13,338, Visits: 10,202
There is no direct alternative for patindex in the derived column. So you can either use a script component with .NET, or stick with SQL.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1487486
Posted Thursday, August 22, 2013 4:43 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, July 28, 2014 4:49 AM
Points: 556, Visits: 2,581
If you can use CLRs you could look at mdq.regexmatches. See this thread.


-- Alan Burstein



Read this article for best practices on asking questions.
Need to split a string? Try this (Jeff Moden)
Need a pattern-based string spitter? Try this (Dwain Camps)
My blog
Post #1487579
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse