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 |
|
twinklestar0802
Starting Member
17 Posts |
Posted - 2005-05-31 : 09:19:06
|
Guys, i need ur help again... i want to display all data. The columns CheckDate (datetime) and CheckAmount (decimal) can be null.In my query, i replace them with the ''. If checkdate is null, it appears to be 1/1/1900. and checkamount will generate and error.I want checkdate and checkamount to appear blank if they are null. How????? Thanx guys SELECT OR_no, InvoiceNumber, PaymentType, AmountPaid, isnull(CheckNumber,''), isnull(CheckDate,''), isnull(CheckAmount,0), isnull(Bank,'') FROM ORDetailswhere OR_no=@or |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-05-31 : 10:14:25
|
| Can't answer this without knowing if you're displaying it in ASP, .NET or just the recordset data.Column values must be of the same type. NULL is typeless, so NULL can appear in a DATETIME column. '' (VARCHAR type) cannot.You could convert the entire column to VARCHAR, then substitute ''...For exampleELECT OR_no, InvoiceNumber,PaymentType, AmountPaid, isnull(CheckNumber,''),IsNULL(CAST(CheckDate AS VARCHAR), '')Or, get even fancier using CONVERT... |
 |
|
|
vivek.kumargupta
Starting Member
45 Posts |
Posted - 2005-06-01 : 01:21:26
|
| Convert checkdate to varchar and apply isnull condition as in "select isnull(cast(checkamount as varchar(100)),0) from ORDetails" same with checkamount but dont cast it only use isnull(CheckAmount,0.0).Thanks, Vivek |
 |
|
|
|
|
|
|
|