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
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