Sample Header Ad - 728x90

force SQLite view column type affinity

3 votes
1 answer
1889 views
Using SQLite 3, I have some view columns which are defined with an expression, and so have no type affinity. Is it possible to define them in a way that forces them to have a certain type affinity? e.g. if I have a tables t1, t2 and a view definition create view v as select coalesce(t1.c1, t2.c1) c1 from t1, t2 where X; is there some way of giving v1.c1 a type affinity? I've tried casting it select cast(coalesce(t1.c1, t2.c1) as INTEGER) c1 but that doesn't seem to work.
Asked by nik (223 rep)
Nov 16, 2015, 03:00 AM
Last activity: May 11, 2025, 05:04 PM