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-07-31 : 02:30:52
|
| I had column CONCENTRATION in Table Drugs which had data like100 mg/50 mlnow i want to display the data into 4 columns100mg50mlHow can i approach for thatSudhakar |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-07-31 : 02:39:42
|
quote: Originally posted by sudha12345 I had column CONCENTRATION in Table Drugs which had data like100 mg/50 mlnow i want to display the data into 4 columns100mg50mlHow can i approach for thatSudhakar
4 columns or 4 rows?PBUH |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-07-31 : 02:47:53
|
| The data has to spillted into 4 rowsSudhakar |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-07-31 : 02:52:56
|
| declare @str as varchar(100)set @str='100 mg/50 ml'select @strselect parsename(Replace(REPLACE(@str,'/','.'),' ','.'),4),parsename(Replace(REPLACE(@str,'/','.'),' ','.'),3),parsename(Replace(REPLACE(@str,'/','.'),' ','.'),2),parsename(Replace(REPLACE(@str,'/','.'),' ','.'),1)PBUH |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-07-31 : 02:58:05
|
| Thanks a lot , how can we do it if i has to display it in 4 columnsSudhakar |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-07-31 : 03:05:53
|
quote: Originally posted by sudha12345 Thanks a lot , how can we do it if i has to display it in 4 columnsSudhakar
Did you try it?It is displaying in 4 columns.PBUH |
 |
|
|
|
|
|
|
|