Application Note for QuNect ODBC for Quick Base

Synchronize a SQL Server table in Quick Base with a trigger

The following stored procedure will make inserts and updates to your Quick Base table keeping it in synch with your SQL Server table. It relies on having the Quick Base key field set to the key field in SQL Server. As a result, both of these fields must be included below in the trigger stored procedure.

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Claude von Roesgen
-- Create date: 2/3/2017
-- Description: Synchronize a SQL Server table in Quick Base with a trigger
-- =============================================
-- This stored procedure depends on the existence of a linked server called
-- Quick Base. To create this linked server watch the following video:
--
-- http://qunect.com/flash/linkedServer.html
--
-- After you have your linked server in place you're ready to run the stored 
-- procedure below. 
CREATE TRIGGER [dbo].[forQuickBase] 
   ON  [dbo].[yourSQLServerTable] 
   AFTER UPDATE, INSERT
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON
	SET XACT_ABORT ON
INSERT INTO QUICKBASE."Your_QuickBase_Application_Name".."Your_QuickBase_Table_Name_bbacdknaw" 
("QuickBase_Key_Field_Name", "Other", "Field", "Names") 
SELECT "SQL_Server_Key_Field_Name", "Other", "Field", "Names" FROM INSERTED; 
END