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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need a query..

Author  Topic 

kishore309
Starting Member

2 Posts

Posted - 2011-10-06 : 07:32:52
Here i'm displaying table of my working project.

CID 8X4 7X4 6X4 8X3 7X3 6X3 5X3
------------------------------------------------------------
13 71 13 7 12 15 NULL NULL
13 76 14 11 4 NULL 7 NULL
13 23 15 10 5 9 1 NULL
13 0 12 9 13 2 18 NULL
13 5 11 NULL 4 13 5 NULL
13 54 14 10 8 6 3 NULL
13 4 NULL 10 2 3 4 NULL
29 1 NULL NULL NULL NULL NULL NULL

I want to display like that.

CID 8X4 7X4 6X4 8X3 7X3 6X3 5X3
------------------------------------------------------------
13 71 13 7 12 15
13 76 14 11 4 7
13 23 15 10 5 9 1
13 12 9 13 2 18
13 5 11 4 13 5
13 54 14 10 8 6 3
13 4 10 2 3 4
29 1

Here i don't want display the records which are having zero's or null values..or replace the character " - " at the place.

how do i write query...
please reply me...

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-10-06 : 07:47:04
[code]
formatted:
Here i'm displaying table of my working project.

CID 8X4 7X4 6X4 8X3 7X3 6X3 5X3
------------------------------------------------------------
13 71 13 7 12 15 NULL NULL
13 76 14 11 4 NULL 7 NULL
13 23 15 10 5 9 1 NULL
13 0 12 9 13 2 18 NULL
13 5 11 NULL 4 13 5 NULL
13 54 14 10 8 6 3 NULL
13 4 NULL 10 2 3 4 NULL
29 1 NULL NULL NULL NULL NULL NULL

I want to display like that.

CID 8X4 7X4 6X4 8X3 7X3 6X3 5X3
------------------------------------------------------------
13 71 13 7 12 15
13 76 14 11 4 7
13 23 15 10 5 9 1
13 12 9 13 2 18
13 5 11 4 13 5
13 54 14 10 8 6 3
13 4 10 2 3 4
29 1

Here i don't want display the records which are having zero's or null values..or replace the character " - " at the place.

how do i write query...
please reply me...

[/code]


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-10-06 : 07:48:03
we need to know the datatypes of the columns


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-06 : 07:48:43
can you do this at your front end application where the result is display ?



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-06 : 08:45:08
this is a presentation issue. Try to do it at your front end.
If you want it to do in T-SQL, look for COALESCE(NULLIF(CAST(Col AS varchar(10)),'0'),'')

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kishore309
Starting Member

2 Posts

Posted - 2011-10-07 : 01:06:01
quote:
Originally posted by visakh16

this is a presentation issue. Try to do it at your front end.
If you want it to do in T-SQL, look for COALESCE(NULLIF(CAST(Col AS varchar(10)),'0'),'')

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




Thanks a lot friend...it's working..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-07 : 01:28:45
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -