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
 How to fix this NULL issue?

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-05-26 : 09:21:58
HI I have a Silverlight app, now the data gets there via a standard stored proc and web data service.
One of the fields in the data is NULL and thus Silverlight is crashing on that customer.
My question is, can I in the SQL, change the status of this field, say I make it all zeros or something like that?
Thank you,
Adam

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-26 : 09:28:33
select
isnull(your_col,'00000') as your_col
from table


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

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-05-26 : 09:35:30
OK so in the current sp, I put your select as a second select?

USE [care]
GO
/****** Object: StoredProcedure [dbo].[SpendAnalyzer] Script Date: 05/26/2010 09:34:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Spendwatch]

@customername varchar(50) = NULL

AS

BEGIN

SET NOCOUNT ON;


SELECT

Department,

Price As Expense,

Quantity,

Customer as CUSTNAME,

item_name as Description,

Date_Created AS DateCreated,

Category,

Category as USCATVAL,

Budget,

po as InvoiceNum

FROM dbo.V_Dashboard_expenses


WHERE

Date_Created >= DATEADD (YYYY, - 2, GETDATE()) AND

Date_Created <= GETDATE() AND

LTrim(RTrim(Customer)) = @customername

ORDER BY date_Created DESC

END

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-26 : 09:41:21
No.
For example if the problem is with the column po in your query then
use
isnull(po,'00000') as InvoiceNum
instead of
po as InvoiceNum


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

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2010-05-26 : 09:48:40
Thank you very much Web Fred!

quote:
Originally posted by webfred

No.
For example if the problem is with the column po in your query then
use
isnull(po,'00000') as InvoiceNum
instead of
po as InvoiceNum


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 - 2010-05-26 : 09:58:27
welcome


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

- Advertisement -