Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find Nth Occurrence of Character Function (Set Based)

By Robert Cary,

This function was originally contributed by other visitors. Below is an example of a set based approach to the problem.

This script requires a numbers table (see SqlServerCentral article http://www.sqlservercentral.com/columnists/mcoles/2547.asp for more details)

Please note that this code is uses SQL2005 features

Enjoy!

Robert Cary

http://tsqlland.blogspot.com

Total article views: 534 | Views in the last 30 days: 1
 
 
Contribute