| Author |
Topic |
|
huynhtl
Posting Yak Master
107 Posts |
Posted - 2008-04-03 : 10:45:09
|
| Hi,I was wondering if there's a way to combine last, first and middle name together in one field instead of three different ones? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-03 : 10:48:45
|
| You want to combine them in query?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
huynhtl
Posting Yak Master
107 Posts |
Posted - 2008-04-03 : 10:49:23
|
| Yes, Please |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-03 : 10:50:01
|
| SELECT ISNULL(lastname,'') + ISNULL(firstname,'') + ISNULL(middlename,'') AS FullName from YourTableEDIT:Added ISNULL check to deal with NULL values in fields |
 |
|
|
huynhtl
Posting Yak Master
107 Posts |
Posted - 2008-04-03 : 11:06:17
|
| Thanks. Is there a way to not have such major space between the last name and the first name? i.e, Doe ,John SI want Doe, John S |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-03 : 11:08:03
|
| Didnt get wat you are asking. Can you explain? |
 |
|
|
huynhtl
Posting Yak Master
107 Posts |
Posted - 2008-04-03 : 11:13:27
|
| I've figure it out. Thanks. Another problem, I want to combine my provider number and the provider name as one, but the error came back asMsg 245, Level 16, State 1, Line 1Syntax error converting the varchar value 'CENTRAL WASHINGTON COMPREHENSIV' to a column of data type int.Provider number is int and provider name is char(31). Is there a way to combine these two fields like the other one? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-03 : 11:19:04
|
| yup. SELECT Providername + CAST(Providernumber as varchar(10)) |
 |
|
|
huynhtl
Posting Yak Master
107 Posts |
Posted - 2008-04-03 : 11:32:02
|
| Perfect!!!!!!!!!!!!!Thank you so much. This makes my life easier. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-04 : 02:10:39
|
quote: Originally posted by visakh16 Didnt get wat you are asking. Can you explain?
OP wants to trim firstnameMadhivananFailing to plan is Planning to fail |
 |
|
|
|