Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 28th, 2005, 09:33 PM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to eliminate all the extra zero?

I have a problem with this view....

OrdQty DespQty Value Total Profit OrdNo
100.0 0.0 4.173 417.329 100.0 044454
1.0 0.0 12.0 12.0 0.0 044454
1.0 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454

In here, how i can eliminate all the zero and null field which is not necessary to display out? i want to do it automatically, because in this DB it will always have new entry.
How to write the sql statement for this kind of problem?
Thanks!

Reply With Quote
  #2 (permalink)  
Old June 28th, 2005, 09:44 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Are you tried filtering your results using a WHERE clause? For example:
SELECT OrdQty, DespQty, Value, Total, Profit, OrdNo
FROM table
WHERE OrdQty IS NOT NULL
AND OrdQty <> 0.0

What does your current SELECT statment look like? What do you want your end results to look like?

Scott

Reply With Quote
  #3 (permalink)  
Old June 29th, 2005, 09:37 PM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No..my SELECT statement is just like
SELECT OrdQty, DeapQty, Value, Total, Profit, OrdNo
FROM view
WHERE OrdNo is < '99999'
But when i try to output the result to the FrontPage, it will display all the extra 0 in the NULL field(which is i dont want)

OrdQty DespQty Value Total Profit OrdNo
100.0 0.0 4.173 417.329 100.0 044454
1.0 0.0 12.0 12.0 0.0 044454
1.0 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
NULL 0.0 0.0 0.0 0.0 044454
So my question is how to get rid the extra zero by using the SELECT statment or IF statement?

Reply With Quote
  #4 (permalink)  
Old June 29th, 2005, 09:47 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The easiest way is to use the SELECT statment and filter the results further in the WHERE clause as I showed earlier.

WHERE OrdNo is < '99999'
AND OrdQty IS NOT NULL

This will return only the records that do not have a ) in the NULL field.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to hide or eliminate console window mohammed imam ahamed Java Basics 0 November 1st, 2008 11:05 PM
How to eliminate special characters from string dadahonde VB How-To 2 March 11th, 2005 05:14 AM
eliminate duplicates where attribute names differ dasdrs XSLT 2 August 9th, 2004 09:29 AM
eliminate duplicates in selected columns Callie SQL Server 2000 3 April 29th, 2004 10:57 PM
Eliminate duplicate entries - sql query nlicata SQL Server 2000 2 September 17th, 2003 10:37 AM



All times are GMT -4. The time now is 05:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.