Stored Proc help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvmashraf
    New Member
    • Oct 2007
    • 36

    Stored Proc help

    Hi..

    I have a select statement inside(WITH statement), In the where clause of the where statement we are checking withe passed argument. The belows are the passed argument
    @MemberID uniqueidentifie r,
    @DateFrom datetime,
    @DateTo datetime,
    @RepID uniqueidentifie r,
    @BrandID uniqueidentifie r

    The statement is folows

    WITH Images (Brand_Name,Bra nd_ID,Product_I D, ImagesCount) AS
    (

    select distinct vb.brand_name,v b.Brand_ID,vb.p roduct_id,count (vb.product_id) as ImagesCount from dbo.vSalesMgr_I mageVisibility vb
    join tblrl_brands b on vb.brand_id = b.brand_id
    where brand_owner = @MemberID and vb.AI_Date between @datefrom and @dateto and vb.Brand_ID = @BrandID
    group by vb.brand_id, vb.brand_name,v b.product_id
    )

    Some times the may null, at that time i need not check with the Brand_ID, If it contains value(Vive versa).
    How can i do that,

    Pls help me to solve.....
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Use the ISNULL() function or use CASE


    -- CK

    Comment

    Working...