I am new to T-SQL and I am having a hard time trying to convert a name field where the middle name should show as and initial followed by a period. Also, I don't want to ignore the null values.
So far this is what I got:
SELECT SUBSTRING(personnelMiddleName, 1, 1) + '. ' AS MI, personnelFirstName + ' ' + ISNULL(personnelMiddleName + ' ', ') + personnelLastName AS
WHERE (personnelID = N'ab-45')
And this is what I get:
MI fullname personnelID
H. Alison Heather Beckman
In Access SQL this is simple to do, however, I can't seem to find the way to concatenate MI with the rest of the name.
Is there a way to create a "ISNULL(SUBSTRING" in the SELECT statement?
Thanks for any guidance you can provide.
View Complete Post