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
Posted Thursday, August 22, 2013 11:23 AM


Group: General Forum Members
Last Login: Tuesday, October 14, 2014 9:23 AM
Points: 16, Visits: 46
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: 2 days ago @ 7:27 AM
Points: 13,902, Visits: 11,815
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

Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, January 29, 2015 1:47 PM
Points: 672, Visits: 3,093
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)

"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

My blog
Post #1487579
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse