Computed Column Help - TSQL -


create table [dbo].[tbllocations](     [latitude] [float] not null,     [longitude] [float] not null,     [location] [varchar](500) not null,     [timestamp] [datetime] not null,     [point] [geography] geography::point(latitude, longitude, 4326) not null ) 

giving me bad syntax @ word as.

isn't how declare computed column?

you don't declare datatype or nullability yourself

create table [dbo].[tbllocations](     [latitude] [float] not null,     [longitude] [float] not null,     [location] [varchar](500) not null,     [timestamp] [datetime] not null,     [point] geography::point(latitude, longitude, 4326)  ) 

in general sql server assume column nullable unless add isnull() around formula.

however tried following column definition

[point2] isnull(geography::point(latitude, longitude, 4326),     geography::stgeomfromtext('linestring(-122.360 47.656, -122.343 47.656)', 4326)) 

and still shows is_nullable in sys.computed_columns doesn't applies clr datatypes (probably sql server doesn't trust these deterministic).

edit: is syntactically valid specify not null long computed column marked persisted i.e.

[point] geography::point(latitude, longitude, 4326) persisted not null 

in particular case attempting create table such definition gives runtime error.

computed column 'point' in table 'foo' cannot persisted because column type, 'geography', non-byte-ordered clr type.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -