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 |
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2008-07-30 : 01:36:52
|
Hi I am trying to select the maximum value of a field from a table but I want to assign 0 inst red of null if the table is empty I tried like this but not workingselect max isnull(QuotationId,0) from InventoryPurchasequotationMasterThanks and Regards Anu Palavila |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-30 : 01:38:50
|
[code]select @max intselect @max = max(QuotationId) from InventoryPurchasequotationMasterselect @max = isnull(@max, 0)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-30 : 01:41:40
|
select @max = isnull(max(QuotationId),0) from InventoryPurchasequotationMaster |
 |
|
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2008-07-30 : 03:54:14
|
Thanks for the answerThanks and Regards Anu Palavila |
 |
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-07-30 : 03:56:55
|
Hi chk this,select isnull(max(QuotationId),0) from InventoryPurchasequotationMaster |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-30 : 10:17:57
|
quote: Originally posted by VGuyz Hi chk this,select isnull(max(QuotationId),0) from InventoryPurchasequotationMaster
how is this different what i suggested two hours ago? |
 |
|
|
|
|