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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-02-25 : 11:07:51
|
Sharon writes "I am new to sql so bear with me here.... This is what I need to do: Field contains business names which can be 1 or more words. Example: Jones Plumbing or American Land Title Association
I want to do one of two things to each business name in this column. Either Condense the name to one word if it is two words or less or create an acronym if it is 3 words or more. Example: JonesPlumbing or ALTA
Am I correct in thinking I can concatenate Jones Plumbing in this fashion:
SELECT REPLACE('ab fgh,' ','') Result being abfgh
will the space in the second expression be recognized or will it cause an error? Instead of using an actual name, could I use a var that passes the contents of the field to the first expression and then performs this action?
As far as creating acronyms goes... I don't have a clue where to start. doing a word count will give me the ability to do an ifthen statement to direct the function to concatenate the names or acronym it. How do I get it to pull only the first letter of each word?
Using Mid() I would have to know the count of all the letters in each field and this is impossible since I have over 1500 fields of varying lengths in the column.
I need to do this either in VB or SQL and not sure which is the best way to do it. SQL 7 on Windows 2000Adv. Server
Thanks, Sharon" |
|
|
|
|
|