Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    78

    Unanswered: error for Creating a VIEW

    I have a question regarding creating a view. Does the view name has to be something in the existing database? I got the following error when I create a view. Please help, thank you.


    Create view V_[I_DETAIL]

    As

    select

    Left([I_DETAIL].[CASTMONTH],4) As CASTYEAR
    ,Right([I_DETAIL].[CASTMONTH],2)As CASTMONTH
    -- using CASE, if aired, make it equal to invoice
    --if failed,make it equal to no invoice else NA
    ,case [I_DETAIL].[VSTATUS]

    when 'Aired' then 'Yes'
    when 'Failed' then 'No'
    else 'Not Applicable'
    end as [INVOICE]

    FROM [Opt].[EDA.[I_DETAIL] as invoice_detail

    Go

    select * from V_[I_DETAIL]

    go


    Msg 2812, Level 16, State 62, Line 1
    Could not find stored procedure 'I_DETAIL'.
    Last edited by Mangolili; 07-18-11 at 11:51.

  2. #2
    Join Date
    Jul 2011
    Posts
    78
    Never mind, I got this to work. However, the viewname still has the red line below it when I select it.

    Even thought it has the read thing under the name, it still run sucessfully.

    select * from V_[I_DETAIL]. Does anyone know the reason?

    Thank you.

  3. #3
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    V_[I_DETAIL]

    Try it with a view name, not containing '[' and ']'.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  4. #4
    Join Date
    Jul 2011
    Posts
    78
    Thanks, Wim.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •