April 17, 2008 at 7:13 am
To all of you T-SQL gurus out there in Cyberland...I am searching for a function or tool that will allow me to do the same thing that 'FINDSTRING' does in SSIS.
Perhaps if I exlplain my situation, there may be other solutions more aptly used to achieve the same end. I have a Name field that is in SQL2K5 that contains the entire name (Lastname, Firstname Middlename). I'm wanting to split each subname portion out in a stored procedure that I'm writing. In SSIS, this is easily achieved by using 'SUBSTRING' and 'FINDSTRING' together.
Any ideas?
Thanks
Rick Mills, MT(ASCP)
Analyst / Programmer
Indiana Health Information Exchange
rmills@ihie.com
April 17, 2008 at 8:02 am
check out CHARINDEX(param1, param2, param3)
param1 -- [string expression] --What you are looking for. In your sitaution ','
param2 -- [string expression/column] --What to search for param1 in
param3 -- [int] -- What character to start the search at. This parameter is optional and defaults to 1.
Dave Novak
April 17, 2008 at 11:17 am
Also check out the string splitter functions on the scripts part of this page.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 17, 2008 at 11:29 am
Thanks Dave, the 'CHARINDEX' function did work. I had looked at it in the beginning of my search for a solution, but for some reason I didn't think it would work. It's a slight variation on the 'FINDSTRING' function, so maybe it threw me somehow...oh well.
This forum is awssome, and thanks for the responses!
Rick Mills, MT(ASCP)
Analyst / Programmer
Indiana Health Information Exchange
rmills@ihie.com
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply