tags:

views:

16

answers:

1

I have multiple views fueling entity framework, and some of the views don't return all the fields as their brethren.

for EF's sake, i need to ensure that all views return the same signature. So in the views that have less fields, i simply add missing columns:

,Column1
,Column2
,null Column3

since Column3 is not in the table returned by the view, i simply add it to match the signature of other views that do have Column3.

My question is, how can I make Column3 typed, so that if i run sp_help MyView that column is returned as string, or int etc.. I know i could return 0 Column3 or '' Column3, but i would like to keep it null.

+3  A: 

Just cast the column:

 ,   cast(null as datetime) as Column3
Andomar