Advertisement

02.12.2008 at 12:14PM PST, ID: 23157551
[x]
Attachment Details

EASY, Peezy Points!!!! How can I do a substring like this is C#?

Asked by OddiC in C# Programming Language, MS SQL Server

Tags: C#, T-SQL

Hi all,

I am moving some code from one of my SP's to my app code and I am not quite sure how to accomplish the same thing in C#. here is what I am trying to do ("Get ONLY the first name (and pref. omit any trailing initials) from an alphaname field which is in the format [lastname], [firstname] [optional initial]

Here is my T-SQL (but it doesn't omit initals):

SUBSTRING(sr.AlphaName, CHARINDEX(',', sr.AlphaName) + 1, len(sr.AlphaName)) As 'First Name'


Any takers???


Thanks to all who can offer some wisdom!!!
Start Free Trial
[+][-]02.12.2008 at 12:22PM PST, ID: 20878468

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.12.2008 at 12:22PM PST, ID: 20878469

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C# Programming Language, MS SQL Server
Tags: C#, T-SQL
Sign Up Now!
Solution Provided By: StanicDejan
Participating Experts: 4
Solution Grade: A
 
 
[+][-]02.12.2008 at 12:28PM PST, ID: 20878530

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.12.2008 at 12:33PM PST, ID: 20878605

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628