.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

how to paramaterize a case condition

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :Sql Server
Im using a stored prcedeure for ssrs that has a case statement in it.  (attached) using a second data set , what would i put in for a select query to select (Y/N) in a dropdown but by default I w to show both   declare @cost_id int declare @RBT_TYP_ID int DECLARE @ACT_FLG int set @cost_id = 66 set @RBT_TYP_ID = (105) SET @ACT_FLG = 1 SELECT r.EM_ITEM_NUM ,r.DSCR ,item.SELL_DSCR ,splr.SPLR_NAM ,rp.AMT ,rp.EFF_DT ,rp.END_DT ,last_upd.DisplayName ,last_upd.MOD_DT ,t.ACTIVE FROM dbo.T_REBATE r INNER JOIN REFERENCE.dbo.T_IW_EM_ITEM item ON r.EM_ITEM_NUM = item.EM_ITEM_NUM INNER JOIN dbo.V_REBATE_LAST_UPDATED last_upd ON r.REBATE_ID = last_upd.REBATE_ID LEFT JOIN dbo.V_GNRC_SPLR splr ON item.SPLR_ACCT_ID = splr.SPLR_ACCT_NUM LEFT JOIN dbo.T_REBATE_PERIOD rp ON r.REBATE_ID = rp.REBATE_ID cross apply (select CASE WHEN GETDATE() BETWEEN rp.EFF_DT AND rp.END_DT + 1 THEN 1 ELSE 0 END AS ACTIVE)t WHERE R.RBT_TYP_ID = @RBT_TYP_ID AND t.ACTIVE = @ACT_FLG

View Complete Post

More Related Resource Links

parameterize case condition

i have a case statement and i need to paramterize by the Y or No flag.   i have declared the variable as bit (tried int also) set @ ACT_FLG = 1   ,CASE WHEN GETDATE() BETWEEN rp.EFF_DT AND rp.END_DT + 1     THEN 1     ELSE 0 END AS ACTIVE   in the where clause ih have this... WHERE ACTIVE = @ACT_FLG   so i am getting this when I run the query Msg 207, Level 16, State 1, Line 68 Invalid column name 'ACTIVE'.

sql case statement with two condition



declare @year int,@month int


while (@month <=13 and @year<=year(getdate()))

SET @month=@month+1
SET @year=case @month when 13 then @year +1
ans @month =1 else @year end 
SET @year=@year+1


in this case statemtent i also want that when year increase means when increment of year happens then month variable shouls chage oe reset to 1 so that loop can start from 1 month of new year..

but i get error in this case statement when i use and @month =1

please help me and provide needful step

How do I handle IsSelected Condition in multiple DataTriggers case ?


Hi all,

I have a customize listBox in which I am defining a DatatTemplete for that ListBox, the code is something like:



<ListBox Name="lstOfImages" 
     Background="Red" >          



            <Grid x:Name="mainGrid">

                 <ColumnDefinition Width="38"/>
                 <ColumnDefinition Width="*"/>

               <Image x:Name="FirstCulomnPanel"

               <Border x:Name="SecondCulomnPanel"

Visual Case Tool - UML Tutorial

The Class Diagram

The class diagram is core to object-oriented design. It describes the types of objects in the system and the static relationships between them.

Use Case Diagram

The use case diagram shows the functionality of the system from an outside-in viewpoint.

Actors (stick men) are anything outside the system that interacts with the system.

how to multiple condition in if statement in asp.net C#



i am using if condition to find out a time

if(time=="08 AM)


response.write"shift A";


but problem is how can i put multiple condition in if like

if(time=="06 AM" and "08 AM" and "07 AM")



Hello, i need help changing the following code into a switch...case statementUndecided

<script runat="server">
void Page_Load()
    if (Page.IsPostBack)
    public String toSring()
    int intcomputerChoice=1;
       if (Page.IsPostBack)

Editor's Note: In Case You Hadn't Noticed .


Find out what's new for MSDN Magazine, including a print redesign and the introduction of virtual labs on our web site so you can experiment with our code.

Howard Dierking

MSDN Magazine June 2008

.NET Migration Case Study: Using ASP.NET to Build the beta.visualstudio.net Web Site


When the Web site used to collect customer feedback about the Visual Studio .NET beta needed an update, the Visual Studio team saw a good opportunity to implement, deploy, and showcase a real-world site using .NET technologies. This article covers the migration of the Web site, beta.visualstudio.net, from components written in Visual Basic 6.0 and ASP hosted on Microsoft Internet Information Services (IIS) 5.0 to ASP.NET and the .NET Framework. The choices of technologies to be incorporated, along with issues such as validation, security, and authentication, are all discussed. Both existing components and the new components written in JScript and ASP.NET that were used to migrate the site are also explained.

Jay Schmelzer

MSDN Magazine September 2001

cache condition always return flase


Hi i got a function that first insert cache object in dataset and then check if its empty then query the database otherwise just get record from the dataset of cache object.

Now the problem is, the condition

If DSEktronID Is Nothing Then '

always return false even when i run the application first time? Any ideas?

   Public Function GetEktronID(ByVal UrlAlias As String, ByVal source As Object) As Integer

Dim application As HttpApplication = DirectCast(source, HttpApplication)
Dim context As HttpContext = application.Context
Dim DSEktronID As New DataSet()
Dim da As SqlDataAdapter
Dim dt As DataTable
Dim EktronId As Integer

DSEktronID = CType(context.Cache("firmEktron"), DataSet)

If DSEktronID Is Nothing Then ' If empty
context.Response.Write("inside if")
Dim conn As SqlConnection
conn = New SqlConnection(ConfigurationManager.ConnectionStrings("GAConnectionStringDev").ConnectionString)

da = New SqlDataAdapter("select content_id, Alias FROM [tbl_MobileTodayLookUP]", conn)

DSEktronID = New DataSet()
da.Fill(DSEktronID, "Ekt

Case statement is never executing


Can some please advise as to why the case statement is never running


Imports Microsoft.VisualBasic
Imports AjaxControlToolkit

Public Class MultilevelAccordion
    Inherits System.Web.UI.UserControl
    Implements System.Web.UI.ITemplate

    Dim templateType As AccordionItemType

    Sub New(ByVal type As AccordionItemType)
        templateType = type

    End Sub

    Sub New()

    End Sub

    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
          Implements System.Web.UI.ITemplate.InstantiateIn

        Dim ph As New PlaceHolder()

        Select Case (templateType)
            Case AccordionItemType.Header
                Dim myLabel As Label = New Label()
                myLabel.ID = "HeaderLabel"

                AddHandler ph.DataBinding, New EventHandler(AddressOf Item_DataBinding)
            Case AccordionItemType.Content
                AddHandler ph.DataBinding, New EventHandler(AddressOf Item_DataBinding)
        End Select
    End Sub

    Shared Sub Item_DataBinding(ByVal sender As Object, ByVal e As AccordionItemEventArgs)

        Dim ph As PlaceHolder = CType(sender, PlaceHolder)
        Dim headerValue As String = _

condition Select query

Hi All.Greetings.I have 1 table.Table 1ID | Name  | Sex       |  DateofBirth1   | abc    | Female  | 19802   |abc2   | Female  |20083   |abc3   |Male       |19854   |abc4   |Male      | 2009I want to see if age is greater then 3 year it will adult girl or adult boy. and If age is less then 3 year then it will be child girl or child boy.I have Output like thenName | Sex         |abc    | Adult girl |abc2  | child girl  |abc4  | child boy | etc.....How to write condition query to get my result.Thanks in Advance.

LINQ to SQL and Case statement

Working with LINQ I realized that I had to use the simple case statement in my SQL query. There is no special keyword for this. To create a case statement like structure you will have to do it in the select section of the query. Below is an example of the usage of the case statement in LINQ. var t = from n in idc.categories            select new             {                        catName =                         (n.id==1 ? "Cat1" :                        n.id==2 ? "Cat2" :                        n.id==3 ? "Cat3" : "Unknown Category"                        )             }; Here in the above code we are using multiple cases for value 1, 2 and 3

Change case using Find & Replace dialog box

Hi, I want to change case of link URLs using Find & Replace dialog box . Is it possible? eg changing http://www.abc.com/S pecial-E dition.aspx, http://www.abc.com/O ther-N ews.aspx to http://www.abc.com/s pecial-e dition.aspx, http://www.abc.com/o ther-n ews.aspx
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend