Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Parse String SSIS
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Johnph
Posting Yak Master

103 Posts

Posted - 03/18/2014 :  11:24:34  Show Profile  Reply with Quote
Hello, I want to parse a string in SSIS. My strings looks like this:

CAT@@@DOG@@@yyyy
MOUSE@@@bbb@@@aaa
r@@@s@@@g

They 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

Sweden
30421 Posts

Posted - 03/18/2014 :  18:06:32  Show Profile  Visit SwePeso's Homepage  Reply with Quote
DECLARE	@Sample TABLE
	(
		Data VARCHAR(100) NOT NULL
	);

INSERT	@Sample
	(
		Data
	)
SELECT	'CAT@@@DOG@@@yyyy' UNION ALL
SELECT	'MOUSE@@@bbb@@@aaa' UNION ALL
SELECT	'r@@@s@@@g';

-- SwePeso
SELECT	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;



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

sqlsaga
Yak Posting Veteran

USA
93 Posts

Posted - 03/27/2014 :  12:07:11  Show Profile  Reply with Quote
You can use a split function as well do it, why SSIS?

http://sqlsaga.com/sql-server/split-function-in-sql-server/

Just change your delimiter to what you need and it work fine..



Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000