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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 initials

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-08-10 : 08:57:22
Hi,
In sql, how do you get the initial of a person?
For example:
David Charles should give DC
John Brown Simmons should give JS

Thanks

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-08-10 : 09:02:09
It's fine now, i will use substring
Thanks
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-08-10 : 09:03:24
declare @name varchar(20)
set @name = 'John Brown Simmons'

select left(@name, 1) + Left(right(@name, charindex(' ', reverse(@name))-1), 1)


Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-10 : 09:09:33
>>David Charles should give DC
John Brown Simmons should give JS

You have to define how you are going to get this

For two part names First Letter of each name
For three part names First Letter of First and third name

Do you follow this logic?



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-08-10 : 09:47:27
How about

Mr. Brett J Kaiser III dba

?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-08-10 : 09:49:12
well brett...
your initial then would be MD... doh...


Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-10 : 09:56:04
so first of first and last?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -