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 |
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-04-25 : 01:21:40
|
| I have a table wih 1 column an 5 rows. The data in the column islike 1st row p1:i1 2nd row p2:i2 3rd row p3:i3 4th row p4:i4 5th row p5:i5and i want the output as 2 columnsserverid customeridp1 i1p2 i2p3 i3p4 i4p5 i5the single column has to be displayed as two columnscan any help meSudhakar |
|
|
matty
Posting Yak Master
161 Posts |
Posted - 2009-04-25 : 01:45:23
|
| SELECT PARSENAME(REPLACE(columnname, ':', '.'), 2) AS serverid, PARSENAME(REPLACE(columnname, ':', '.'), 1) AS customeridFROM TableName |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-04-25 : 03:24:38
|
quote: Originally posted by matty SELECT PARSENAME(REPLACE(columnname, ':', '.'), 2) AS serverid, PARSENAME(REPLACE(columnname, ':', '.'), 1) AS customeridFROM TableName
has a report that i will take different serverids and different customerids.so as i told there was data above, what we planned is to takethe serverids and customerids individully and compare the results between them.for ex :serverid customerid valuep1 i1 20p2 i2 34p3 i3 45p4 i4 80so we planned to take individually both the serverids and customeridsand then compare the dataSudhakarselect * from table where serverid = p1 and customerid = i1unionselect * from table where serverid = p2 and customerid = i2unionselect * from table where serverid = p3 and customerid = i3unionselect * from table where serverid = p4 and customerid = i4is it possible to implement? if possible how can we implement thisplease help me , its urgentSudhakar |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-25 : 03:35:19
|
quote: Originally posted by sudha12345
quote: Originally posted by matty SELECT PARSENAME(REPLACE(columnname, ':', '.'), 2) AS serverid, PARSENAME(REPLACE(columnname, ':', '.'), 1) AS customeridFROM TableName
has a report that i will take different serverids and different customerids.so as i told there was data above, what we planned is to takethe serverids and customerids individully and compare the results between them.for ex :serverid customerid valuep1 i1 20p2 i2 34p3 i3 45p4 i4 80so we planned to take individually both the serverids and customeridsand then compare the dataSudhakarselect * from table where serverid = p1 and customerid = i1unionselect * from table where serverid = p2 and customerid = i2unionselect * from table where serverid = p3 and customerid = i3unionselect * from table where serverid = p4 and customerid = i4is it possible to implement? if possible how can we implement thisplease help me , its urgentSudhakar
Do you want to compare the column value?What is your expected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-04-25 : 03:38:29
|
quote: Originally posted by madhivanan
quote: Originally posted by sudha12345
quote: Originally posted by matty SELECT PARSENAME(REPLACE(columnname, ':', '.'), 2) AS serverid, PARSENAME(REPLACE(columnname, ':', '.'), 1) AS customeridFROM TableName
has a report that i will take different serverids and different customerids.so as i told there was data above, what we planned is to takethe serverids and customerids individully and compare the results between them.for ex :serverid customerid valuep1 i1 20p2 i2 34p3 i3 45p4 i4 80so we planned to take individually both the serverids and customeridsand then compare the dataSudhakarselect * from table where serverid = p1 and customerid = i1unionselect * from table where serverid = p2 and customerid = i2unionselect * from table where serverid = p3 and customerid = i3unionselect * from table where serverid = p4 and customerid = i4is it possible to implement? if possible how can we implement thisplease help me , its urgentSudhakar
Do you want to compare the column value?What is your expected result?MadhivananFailing to plan is Planning to fail
yes. we have compare the column value among the combination of serverand customeri.e value beween p1 and i1then value between p2 and i2then value btween p3 and i3and so onnote that serverid and cusomerid acts like a combinationSudhakar |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-25 : 04:10:06
|
| Do you want to display the difference after comparison?MadhivananFailing to plan is Planning to fail |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-04-25 : 04:46:13
|
quote: Originally posted by madhivanan Do you want to display the difference after comparison?MadhivananFailing to plan is Planning to fail
not that. that values will be displayed in the form chart in front endif we display the difference alsi it is fineSudhakar |
 |
|
|
|
|
|
|
|