the spanish queries name month for ansi_warnings ansi_nulls and sql-server tsql triggers

sql-server - queries - get month name sql server in spanish



Las consultas heterogéneas requieren ANSI_NULLS (1)

Intenta usar esto

GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[TR_POSTGRESQL_UPDATE_YC] ON [dbo].[BCT_CNTR_EVENTS] AFTER INSERT AS BEGIN DECLARE @MOVE_TIME varchar(14); DECLARE @MOVE_TIME_FORMATED varchar(20); DECLARE @RELEASE_NOTE varchar(32); DECLARE @CMR_NUMBER varchar(15); DECLARE @MOVE_TYPE varchar(2); SELECT @MOVE_TIME = inserted.move_time ,@MOVE_TYPE = inserted.move_type ,@RELEASE_NOTE = inserted.release_note ,@CMR_NUMBER = inserted.cmr_number FROM inserted IF(@MOVE_TYPE = ''YT'') BEGIN SET @MOVE_TIME_FORMATED = SUBSTRING(@MOVE_TIME,1,4) + ''-'' + SUBSTRING(@MOVE_TIME,5,2) + ''-'' + SUBSTRING(@MOVE_TIME,7,2) + '' 00:00:00'' SET ANSI_NULLS ON SET ANSI_WARNINGS ON UPDATE OpenQuery(POSTGRESQL_SERV,''SELECT visit_cmr,visit_timestamp,visit_pin FROM VISIT'') SET visit_cmr = @RELEASE_NOTE WHERE visit_timestamp = @MOVE_TIME_FORMATED AND visit_pin = right(@CMR_NUMBER,5) AND visit_cmr IS NULL END SET NOCOUNT ON; END

He escrito un disparador.

USE [TEST] GO /****** Object: Trigger [dbo].[TR_POSTGRESQL_UPDATE_YC] Script Date: 05/26/2010 08:54:03 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[TR_POSTGRESQL_UPDATE_YC] ON [dbo].[BCT_CNTR_EVENTS] FOR INSERT AS BEGIN DECLARE @MOVE_TIME varchar(14); DECLARE @MOVE_TIME_FORMATED varchar(20); DECLARE @RELEASE_NOTE varchar(32); DECLARE @CMR_NUMBER varchar(15); DECLARE @MOVE_TYPE varchar(2); SELECT @MOVE_TIME = inserted.move_time ,@MOVE_TYPE = inserted.move_type ,@RELEASE_NOTE = inserted.release_note ,@CMR_NUMBER = inserted.cmr_number FROM inserted IF(@MOVE_TYPE = ''YC'') BEGIN SET @MOVE_TIME_FORMATED = SUBSTRING(@MOVE_TIME,1,4) + ''-'' + SUBSTRING(@MOVE_TIME,5,2) + ''-'' + SUBSTRING(@MOVE_TIME,7,2) + '' 00:00:00'' --UPDATE OpenQuery(POSTGRESQL_SERV,''SELECT visit_cmr,visit_timestamp,visit_pin FROM VISIT'') -- SET visit_cmr = @RELEASE_NOTE -- WHERE visit_timestamp = @MOVE_TIME_FORMATED -- AND visit_pin = right(@CMR_NUMBER,5) -- AND visit_cmr IS NULL END SET NOCOUNT ON; END

He recibido un error cuando intenté insertar una fila.

Las consultas heterogéneas requieren que se establezcan las opciones ANSI_NULLS y ANSI_WARNINGS para la conexión. Esto garantiza una semántica de consulta consistente. Habilite estas opciones y vuelva a emitir su consulta.

Después de eso, he intentado usar SET SET ANSI_WARNINGS is ON , pero no funciona. (un disparador para el servidor vinculado PostgreSql)