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
 IF Then Statements

Author  Topic 

stevehatpa
Starting Member

21 Posts

Posted - 2008-06-03 : 15:15:57
I need to create a brief statement in Design View for SQL 2000.

I successfully wrote "isnull(dbo.Data.Parcel,'')in the Column in Design View, which would ensure that a null value would be listed as a blank. Now I need to have dbo.data.status show as 'C&G' in any instance of data, otherwise it will be listed as blank. I tried writing "isnotnull(db0.data.status,'Homestead', '')", but it does not work.

Is there a simple statement I can write in "column" of design view that can get the results that I need?

-Steve

SusanthaB
Starting Member

14 Posts

Posted - 2008-06-03 : 15:30:39
try some thing like this.

CASE WHEN Status='Homestead' THEN ' ' ELSE Status END

Susantha Bathige
Senior DBA, Sri Lanka
Go to Top of Page

stevehatpa
Starting Member

21 Posts

Posted - 2008-06-03 : 15:43:10
Thanks!
However, I was wondering if there was a way to do it from the Column in Design view. I need to have dbo.data.status show as 'C&G' where there is any instance of data, otherwise it will be listed as blank. Can this be done in the "Column" of design view?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-03 : 23:57:14
Are you asking about SQL reporting services? If yes, use like this

=IIF(LEN(Fields!status.value)>0,"C&G","")
Go to Top of Page

stevehatpa
Starting Member

21 Posts

Posted - 2008-06-04 : 09:20:53
Unfortunately, I'm not using SQL Reporting Services and that expression did not work in Design View.

In Design View in the VIEWS section of SQL 2000, there are the columns titled Column, Alias, Table, Output, Sort Type, Sort Order, Criteria, etc....

I'm working with an existing "VIEW", so I'm trying to stick with what I have. In the Column section I have columns such as Name, Address1, Address2, etc, taken from other linked tables in the View. There is also one (mentioned above) that has the expression isnull(dbo.Data.Parcel,'')in the Column section. This is called Exp1 and will show the data.parcel info, but list any null values as a blank. What I'm looking for is an expression that I can put in the Column section of the VIEW in Design View that will show dbo.data.status as 'C&G' where there is any instance of data, otherwise it will be listed as blank.

I know this isn't the proper way of doing things, but I am trying to edit an already existing VIEW with limited knowledge, so if there is a way to write an expression in the Column section of Design View it would be greatly appreciated.

-Steve
Go to Top of Page
   

- Advertisement -