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 |
scottichrosaviakosmos
Yak Posting Veteran
66 Posts |
Posted - 2010-09-25 : 03:45:46
|
select gender,amt,age,[address],class ,Case when gender= '' then 'gender,'when gender is null then 'gender,' Else '' End + Case when amt = '' then 'amt,'when amt is null then 'amt,' Else '' End + Case when age = '' then 'age,'when age is null then 'age,' Else '' End + case when [address] = ''then 'address'when [address] is null then 'address,' else '' End + Case when class = '' then 'class,'when class is null then 'class,' Else '' End As [Error Remarks] from mytable The above query is used to check if any of this row is blank or null display the result in a column name "error remarks" .Now the result i m getting is :gender, amt, age,address,classall this result is displayed in a single line in a single cell.now i want the result to be displayed in different line:like this:gender,amt,age,[address],classall this is single cell with the above query.scoo |
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-25 : 04:14:04
|
Post the query you have tried so far.PBUH |
 |
|
scottichrosaviakosmos
Yak Posting Veteran
66 Posts |
Posted - 2010-09-25 : 04:18:03
|
the above query i pasted is the query . and i have tried char(13),Char(13)+char(10) also ..still the result is not comming in next linescoo |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-09-25 : 04:28:24
|
Sorry didnt see it.Easiest way will be to use a union.Maybe it wont be that efficient on a large table.declare @tbl as table(nm varchar(20),nm1 varchar(20))insert into @tblselect 'g','g1'select case when nm='g' then 'g' else '' end from @tblunionselect case when nm1='g1' then 'g1' else '' end from @tbl PBUH |
 |
|
Sachin.Nand
2937 Posts |
|
|
|
|
|
|