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 |
Johnph
Posting Yak Master
103 Posts |
Posted - 2014-03-18 : 11:24:34
|
Hello, I want to parse a string in SSIS. My strings looks like this:CAT@@@DOG@@@yyyyMOUSE@@@bbb@@@aaar@@@s@@@gThey are separated by @@@ and I need code that is able to pull the 1st or 2nd or 3rd characters.Thanks. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-03-18 : 18:06:32
|
[code]DECLARE @Sample TABLE ( Data VARCHAR(100) NOT NULL );INSERT @Sample ( Data )SELECT 'CAT@@@DOG@@@yyyy' UNION ALLSELECT 'MOUSE@@@bbb@@@aaa' UNION ALLSELECT 'r@@@s@@@g';-- SwePesoSELECT PARSENAME(Data, 3) AS [First], PARSENAME(Data, 2) AS [Second], PARSENAME(Data, 1) AS [Third]FROM ( SELECT REPLACE(Data, '@@@', '.') AS Data FROm @Sample ) AS d;[/code] Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
sqlsaga
Yak Posting Veteran
93 Posts |
|
|
|
|
|
|