SQL Server Performance

Query Consuming Time

Discussion in 'SQL Server 2005 Performance Tuning for DBAs' started by Jackson1111, Aug 10, 2009.

  1. Jackson1111 New Member

    Hi All,
    The below query is consuming time , please provide inputs to optimize
    RETURN ( SELECT TOP {##} CASE WHEN @TYPE = {STR} THEN CONVERT(VARCHAR({##}),EDW_STY_CLR_ID ,{##}) WHEN @TYPE = {STR} THEN CONVERT(VARCHAR({##}),STY_NBR_9DIGIT,{##}) WHEN @TYPE = {STR} THEN CONVERT(VARCHAR({##}),CRT_DT,{##}) END FROM T_LKP_PROMPT_STYLE_NBR WHERE BRD_ID = @BRD_ID AND STY_NBR = @STY_NBR AND CLR_ID = @CLR_ID AND MKT_ID = @MKT_ID )
  2. Luis Martin Moderator

    Welcome to the forums!. Could you provide more information?. Tables, indexes, etc.
  3. preethi Member

    This is a shot to the dark. In your query You have used case statement based on @TYPE = {STR}
    Can't you please it in an If statement
    IF @TYPE = {STR}
    Sattement 1
    ELSE
    Statement 2
    Do you have proper indexes?

Share This Page