Trggier not working with insert
-
Hi, I have an insert command saved to a table in a database "after insert" the trigger take the insert command and execute it. when the trigger execute it save the tweet in a second table on the in the same database and it work fine but the trigger in the second table does not work at all. following are the trigger and the table's:-
Command Insert
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON
INSERT INTO [jbmolver].[dbo].[all_tweets] ([set_str],[name]) VALUES
("INSERT INTO [jbmolver].[dbo].[Twitter_Feeds] ([Twitter_ID],[Feed_ID],[Twitter_Date],[screen_name],[Author_Details],[Author_Email],[Author],[Sentiment],[sdate],[edate],[keyword],[type],[ncount],[latitude],[longitude],[radius],[lang],[friends_count],[followers_count],[following],[statuses_count],[location],[time_zone],[description],[in_reply_to_status_id],[in_reply_to_user_id],[in_reply_to_screen_name],[Rcounter],[address],[Feed_From_SM],[profile_image],[current_user_retweet],[withheld_scope],[retweet_count],[favourites_count],[url_type],[hashtags],[expanded_url]) VALUES ('933231091967778816','799796908478894080','2017-11-22 09:10:05',N'prettyraebae',N'Sis it s almost 2018 😭 https://twitter.com/babydrii\_/status/933230970412683264', '', 'Rae', '1', '', '', '', 'photo', '', '', '', '', 'en', '461', '737', '', '12503', '', '', N'UGA 20 ❤️', '', '', '', '0', '$', '2', 'http://pbs.twimg.com/profile\_images/867998936388313089/2Zdl5P2-\_normal.jpg', '0', '0', '0', '27988', '', '', '')", 'Twitter_Feeds')Table No. One:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[all_tweets](
[id] [int] IDENTITY(1,1) NOT NULL,
[set_str] [nvarchar](max) NULL,
[name] [nchar](30) NULL,
CONSTRAINT [PK_all_tweets] 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]
GOTrigger on Table One:
/****** Object: Trigger [dbo].[exec_Update] Script Date: 11/23/2017 5:09:00 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[exec_Update] on [dbo].[all_tweets]
AFTER INSERT
AS
BEGIN
declare @id int = 0
set @id = ( select top 1 id from inserted )
exec [dbo].[execute_all_tweets] '[dbo].[all_tweets]','[set_str]',@id
ENDTable Number Two
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Twitter_Feeds](
[id] [int] IDENTITY(1,1) NOT NULL,
[Twitter_ID] [bigint] NOT NULL CONSTRAINT [DF_Twitter_Feeds_Twitte -
Hi, I have an insert command saved to a table in a database "after insert" the trigger take the insert command and execute it. when the trigger execute it save the tweet in a second table on the in the same database and it work fine but the trigger in the second table does not work at all. following are the trigger and the table's:-
Command Insert
SET QUOTED_IDENTIFIER OFF
SET ANSI_NULLS ON
INSERT INTO [jbmolver].[dbo].[all_tweets] ([set_str],[name]) VALUES
("INSERT INTO [jbmolver].[dbo].[Twitter_Feeds] ([Twitter_ID],[Feed_ID],[Twitter_Date],[screen_name],[Author_Details],[Author_Email],[Author],[Sentiment],[sdate],[edate],[keyword],[type],[ncount],[latitude],[longitude],[radius],[lang],[friends_count],[followers_count],[following],[statuses_count],[location],[time_zone],[description],[in_reply_to_status_id],[in_reply_to_user_id],[in_reply_to_screen_name],[Rcounter],[address],[Feed_From_SM],[profile_image],[current_user_retweet],[withheld_scope],[retweet_count],[favourites_count],[url_type],[hashtags],[expanded_url]) VALUES ('933231091967778816','799796908478894080','2017-11-22 09:10:05',N'prettyraebae',N'Sis it s almost 2018 😭 https://twitter.com/babydrii\_/status/933230970412683264', '', 'Rae', '1', '', '', '', 'photo', '', '', '', '', 'en', '461', '737', '', '12503', '', '', N'UGA 20 ❤️', '', '', '', '0', '$', '2', 'http://pbs.twimg.com/profile\_images/867998936388313089/2Zdl5P2-\_normal.jpg', '0', '0', '0', '27988', '', '', '')", 'Twitter_Feeds')Table No. One:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[all_tweets](
[id] [int] IDENTITY(1,1) NOT NULL,
[set_str] [nvarchar](max) NULL,
[name] [nchar](30) NULL,
CONSTRAINT [PK_all_tweets] 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]
GOTrigger on Table One:
/****** Object: Trigger [dbo].[exec_Update] Script Date: 11/23/2017 5:09:00 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[exec_Update] on [dbo].[all_tweets]
AFTER INSERT
AS
BEGIN
declare @id int = 0
set @id = ( select top 1 id from inserted )
exec [dbo].[execute_all_tweets] '[dbo].[all_tweets]','[set_str]',@id
ENDTable Number Two
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Twitter_Feeds](
[id] [int] IDENTITY(1,1) NOT NULL,
[Twitter_ID] [bigint] NOT NULL CONSTRAINT [DF_Twitter_Feeds_TwitteSeems like a bad design, but here's the setting you need to change: Configure the nested triggers Server Configuration Option | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer