Hi,
I am building a View with an integer column by filtering data from Master table and below is the sample script. And Select Query on the View with WHERE condition is throwing the following exception.
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'ABCDEF' to data type int.
----------------------Creating Table----------------------------------
Create table MasterEmployees (EmpIDvarchar(50))
Insert intoMasterEmployeesvalues('12345'),('ABCDEF')
----------------Creating the view ------------------------
Create viewChildEmployees
AS
Select Cast(EmpiDas bigint)asEmpIDfromMasterEmployeeswhereISNUMERIC(EmpID)=1
---------------------------Issue ----------------------------
Executing Select query on View without WHERE condition is working fine.
Adding WHERE condition to the Query like below
Select *fromChildEmployeeswhereEmpid=1 is throwing below exception
-------------------------Exception Message-----------------------
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'ABCDEF' to data type int.
Please help
Mohan