Dear all,
I have an sql table define as below :
CREATE TABLE [dbo].[PropertyGeoLocalisation]( [Id] [int] IDENTITY(1,1) NOT NULL, [PropertyId] [int] NOT NULL, [Longitude] [float] NULL, [Latitude] [float] NULL, [Easting] [int] NULL, [Northing] [int] NULL, [Bing_Longitude] [float] NULL, [Bing_Latitude] [float] NULL, [CenterPoint] [geography] NULL, CONSTRAINT [PK_PropertyGeoLocalisation] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[PropertyGeoLocalisation] WITH CHECK ADD CONSTRAINT [FK_PropertyGeoLocalisation_Vebra_PropertyDetails] FOREIGN KEY([PropertyId]) REFERENCES [dbo].[Vebra_PropertyDetails] ([Id]) ON DELETE CASCADE GO ALTER TABLE [dbo].[PropertyGeoLocalisation] CHECK CONSTRAINT [FK_PropertyGeoLocalisation_Vebra_PropertyDetails] GO
Then I have a trigger which should calculate the CenterPoint field based on the following :
ALTER TRIGGER [dbo].[SetGeographyCenterPoint] ON [dbo].[PropertyGeoLocalisation] AFTER INSERT,UPDATE AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; UPDATE [RealEstateAgent].[dbo].[PropertyGeoLocalisation] SET [CenterPoint] = GEOGRAPHY::STGeomFromText('POINT('+Str([Longitude], 10, 5)+' ' +Str([Latitude],10,5)+')', 4326) END
When I insert an item manually in my table, the trigger seems to not fire and update the column.
I am using SQL server 2012, any idea what could be wrong ?
Under SQL server 2008 it was working fine
Thanks for tips
regards