[Last Call] Learn how to a build a cloud-first strategyRegister Now


Stored Procedure SQL 2005

Posted on 2011-04-20
Medium Priority
Last Modified: 2012-05-11
I have a stored procedure where I display the following column InsuredFile.LastName in a datasheet. What I want is if SlotType <> S then display InsuredFile.LastName if SlotType = S then display nothing for InsuredFile.LastName
Question by:mburk1968
LVL 19

Accepted Solution

Bhavesh Shah earned 1000 total points
ID: 35432182

you can use

SELECT CASE WHEN SlotType<>5 then  InsuredFile.LastName else '' end as LastName
FROM TableName

LVL 21

Expert Comment

by:Alpesh Patel
ID: 35432255
Select (Case When SlotType <> 'S' then InsuredFile.LastName Else NULL END) From Table

Expert Comment

ID: 35432267
              THEN InsuredFile.LastName END as LastName
FROM TableName

=> if SlotType=5 the value for LastName will be NULL!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question