Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

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


Group: General Forum Members
Last Login: Sunday, April 24, 2016 10:44 AM
Points: 16, Visits: 49
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



Group: General Forum Members
Last Login: Yesterday @ 2:09 AM
Points: 15,501, Visits: 13,163
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 SQLKover.

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



Group: General Forum Members
Last Login: Yesterday @ 8:20 PM
Points: 2,155, Visits: 7,262
If you can use CLRs you could look at mdq.regexmatches. See this thread.

-- Alan Burstein

Best practices for getting help on SQLServerCentral
Need to split a string? Try DelimitedSplit8K or DelimitedSplit8K_LEAD (SQL 2012+)
Need a pattern-based splitter? Try PatternSplitCM
Need to remove or replace those unwanted characters? Try PatExclude8K and PatReplace8K.

"I can't stress enough the importance of switching from a 'sequential files' mindset to 'set-based' thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code. " -- Itzek Ben-Gan 2001
Post #1487579
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse