Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2006, 03:42 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default problem adding two columns

hai

i am trying to subtract two column max and min.
The problem is that the max column can contains null values. when i try to subtract these two columns it returns null values if max value is null. how can i handle this i want to show the value if min is not null.

regards


vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
 
Old February 28th, 2006, 10:22 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Look into using the ISNULL function and put the subtraction in an IF statement. Something like:

IF ISNULL(maxvalue, 0) <> 0
BEGIN
  --Do subtration
END
ELSE
BEGIN
  --do something else...

There is probably also a better way to do this but this is just off the top of my head. Hope it helps...

Scott

 
Old March 6th, 2006, 10:56 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

thanks for ur help. its working fine

vamsi





Similar Threads
Thread Thread Starter Forum Replies Last Post
vba question on adding certain columns csilla Excel VBA 0 July 30th, 2008 05:25 AM
Adding columns to Gridview gagansharma7 ADO.NET 1 February 15th, 2008 10:54 AM
problem with the INFORMATION_SCHEMA.COLUMNS nadunh SQL Server 2000 0 December 17th, 2006 05:53 AM
adding columns to matrix [email protected] BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 May 4th, 2005 07:05 AM
Adding optional columns? shaileshmark SQL Server 2000 9 July 24th, 2004 03:57 PM





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