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
 General SQL Server Forums
 New to SQL Server Programming
 Delimit by double space

Author  Topic 

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-17 : 16:07:47
I need to create a report from a table which has the name of customer.

The requirement is to concatenate the FirstName,Middle Name and Last Name into a single field in the report.

I need to delimit the LastName by two spaces and only pick that value.
If the last names in the table are SMITH,Mc DONALD and SINARA JOHN, the corresponding report values will be SMITH,Mc DONALD and SINARA.

SINARA JOHN becomes SINARA as it has more than 2 spaces between the 2 words.

Hope I make sense. How can I select the value this way?

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-17 : 16:11:59
I wasn't able to show 3 spaces between SINARA and JOHN as the format was changed while posting. So just assume the two words are separated by 3 spaces.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-17 : 16:20:27
Format the data in your application, not in SQL Server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-17 : 16:32:50
The architecture is like this.
A staging table is created everyday as part of a SP within an SSIS package and also creates a flat file which is used by another system.

So if I make the change, I will have to change the SP or the SSIS package to get the name format
Go to Top of Page
   

- Advertisement -