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 |
ntn104
Posting Yak Master
175 Posts |
Posted - 2011-02-10 : 17:05:18
|
I have to display 4 fields on web page: ACCOUNTNO, NAME1, NAME2,ID1, ID2, but available data in table only 3 fields for ACCOUNTNO, NAME, ID. Please see below for example:ACCOUNTNO: 45678900NAME: SMITH, JOHN; SMITH, KATHYID: 111-222-4567; 222-333-5678How would I loop through record do display the correct for each. Below is my sample code for display...<td>Account No:</td><td><%("accountno")%></td><td>Name1:</td><td>?????thanks, |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-11 : 10:13:08
|
Make use of this resultsetselect AccountNo, parsename(replace(name,';','.'),2) as name1,parsename(replace(name,';','.'),2) as name2,parsename(replace(id,';','.'),2) as id1,parsename(replace(id,';','.'),2) as id2 from tableMadhivananFailing to plan is Planning to fail |
|
|
ntn104
Posting Yak Master
175 Posts |
Posted - 2011-02-12 : 21:04:04
|
Hello,Actually the format of table as below, no semicolon as I describe in early message. Sorry I should listed as the way in the table. I wonder if i can use parsename for this? Thanks,ACCOUNTNO NAME ID45678900 SMITH, JOHN 111222456745678900 SMITH, KATHY 2223335678quote: Originally posted by madhivanan Make use of this resultsetselect AccountNo, parsename(replace(name,';','.'),2) as name1,parsename(replace(name,';','.'),2) as name2,parsename(replace(id,';','.'),2) as id1,parsename(replace(id,';','.'),2) as id2 from tableMadhivananFailing to plan is Planning to fail
|
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-14 : 04:36:29
|
In the above example use ',' inplace of ';'MadhivananFailing to plan is Planning to fail |
|
|
ntn104
Posting Yak Master
175 Posts |
Posted - 2011-02-15 : 10:20:24
|
Sorry it's not working...error message to indicate: Procedure 'parsename' not found.What should I do? thanks,quote: Originally posted by madhivanan In the above example use ',' inplace of ';'MadhivananFailing to plan is Planning to fail
|
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-15 : 10:25:58
|
quote: Originally posted by ntn104 Sorry it's not working...error message to indicate: Procedure 'parsename' not found.What should I do? thanks,quote: Originally posted by madhivanan In the above example use ',' inplace of ';'MadhivananFailing to plan is Planning to fail
Are you using SQL Server?MadhivananFailing to plan is Planning to fail |
|
|
ntn104
Posting Yak Master
175 Posts |
Posted - 2011-02-15 : 11:10:03
|
I am using sybase. However, I tried to loop record through account no, so it worked. But I am curious if "parsename" work on sybase.thanks,quote: Originally posted by madhivanan
quote: Originally posted by ntn104 Sorry it's not working...error message to indicate: Procedure 'parsename' not found.What should I do? thanks,quote: Originally posted by madhivanan In the above example use ',' inplace of ';'MadhivananFailing to plan is Planning to fail
Are you using SQL Server?MadhivananFailing to plan is Planning to fail
|
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-02-16 : 09:04:53
|
quote: Originally posted by ntn104 I am using sybase. However, I tried to loop record through account no, so it worked. But I am curious if "parsename" work on sybase.thanks,quote: Originally posted by madhivanan
quote: Originally posted by ntn104 Sorry it's not working...error message to indicate: Procedure 'parsename' not found.What should I do? thanks,quote: Originally posted by madhivanan In the above example use ',' inplace of ';'MadhivananFailing to plan is Planning to fail
Are you using SQL Server?MadhivananFailing to plan is Planning to fail
This site is for MS SQL Server. For sybase questions, try at sybase forumsMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|