April 27, 2005 at 6:01 am
HI,
I created a view as
Create View view1
As
Select empId, Null as empName from employee
IN this, the data type of Null is int by default. If i do some search against empName through view with character data, it throws error. How to overcome this problem.
I already tried with cast, Nullif. Can any one tell me how to get the same datatype of the column name we have in table other than this.
April 27, 2005 at 6:20 am
Can you post your SEARCH statement?
NULL is NOT a datatype but rather a STATE of DATA i.e. NOTHING... In your above VIEW ALL EmpName will = NULL AND no matter what name you are searching for you will NOT find it IF you are searching WHERE empName = 'Smith'
However, IF you are searching WHERE empId = 'Smith' it will ERROR because SMITH is not a number.
To "bind" the datatypes of your VIEW you can research through BOL for WITH SCHEMABINDING however, I think in this case it is a syntax problem and not data type driven....
Good Hunting!
AJ Ahrens
webmaster@kritter.net
April 27, 2005 at 6:30 am
HI,
Thanks for your prompt response.
But schemabinding option will not work for this scenario, i think so.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply