Sometime we have requirement to delete/drop all the triggers from a SQL Server Database. The below code can be used to drop all the triggers on all the tables you have created in a SQL Server database. Before you go ahead and run this script, please make sure you have chosen correct database and server as it will delete all the triggers from chosen SQL Server Database.
USE [Database]
GO
DECLARE @TriggerName AS VARCHAR(500)
-- Drop or Delete All Triggers in a Database in SQL Server
DECLARE DropTrigger CURSOR FOR
SELECT TRG.name AS TriggerName
FROM sys.triggers TRG
INNER JOIN sys.tables TBL
ON TBL.OBJECT_ID = TRG.parent_id
OPEN DropTrigger
FETCH Next FROM DropTrigger INTO @TriggerName
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQL VARCHAR(MAX)=NULL
SET @SQL='Drop Trigger ' + @TriggerName
PRINT 'Trigger ::' + @TriggerName
+ ' Droped Successfully'
EXEC (@SQL)
PRINT @SQL
FETCH Next FROM DropTrigger INTO @TriggerName
END
CLOSE DropTrigger
DEALLOCATE DropTrigger
USE [Database]
GO
DECLARE @TriggerName AS VARCHAR(500)
-- Drop or Delete All Triggers in a Database in SQL Server
DECLARE DropTrigger CURSOR FOR
SELECT TRG.name AS TriggerName
FROM sys.triggers TRG
INNER JOIN sys.tables TBL
ON TBL.OBJECT_ID = TRG.parent_id
OPEN DropTrigger
FETCH Next FROM DropTrigger INTO @TriggerName
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQL VARCHAR(MAX)=NULL
SET @SQL='Drop Trigger ' + @TriggerName
PRINT 'Trigger ::' + @TriggerName
+ ' Droped Successfully'
EXEC (@SQL)
PRINT @SQL
FETCH Next FROM DropTrigger INTO @TriggerName
END
CLOSE DropTrigger
DEALLOCATE DropTrigger
Nice content, It is definitely very helpful for my professional workers. I having many kinds of knowledge from your blog...
ReplyDeleteOracle Training in Chennai
Oracle Training institute in chennai
Pega Training in Chennai
Tableau Training in Chennai
Oracle DBA Training in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Power BI Training in Chennai
Oracle Training in Chennai
Oracle Training institute in chennai
IEEE Final Year projects Project Center in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes. Final Year Project Domains for IT
DeleteJavaScript Training in Chennai
JavaScript Training in Chennai
The Angular Training covers a wide range of topics including Components, project projects for cse. Angular Training
This comment has been removed by the author.
ReplyDeleteGreat post. keep sharing such a worthy information
ReplyDeleteGerman Classes in Chennai
German Classes in Bangalore
German Classes in Coimbatore
German Classes in Madurai
German Language Course in Hyderabad
German Courses in Chennai
German Courses in Bangalore
German Courses in Coimbatore
German classes in marathahalli
Tally Course in Coimbatore
Great experience for me by reading this blog. Thank you for wonderful article.
ReplyDeleteAngularjs Training in Chennai
Angularjs Training in Bangalore
angularjs training institute in bangalore
Angular Training in hyderabad
best angularjs training in bangalore
Angular course in hyderabad
Salesforce Training in Bangalore
Hadoop training in bangalore
Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time
ReplyDeletesql dba training
sql server dba online training
This is an awesome post. Really very informative and creative contents. oracle training in chennai
ReplyDelete
ReplyDeleteFirstly talking about the Blog it is providing the great information providing by you . Thanks for that .Hope More articles from you . Next i want to share some information about Salesforce training in Banglore .
Salesforce communities have an important role in improving the connection among the customers, channel partners and internal employees of a company. Salesforce interview questions and answers
ReplyDeleteThis post is very easy to read. Great work!
ReplyDeletehow to clear ielts
qualifications required for ethical hacker
how do you handle stress and pressure
java required for selenium
ethical hacking interview questions and answers
Nice reading, This is an informative information, thanks for sharing this blog.
ReplyDeleteBpm Tools Training in Bangalore
Very useful blog. In this blog, I got so much useful information.
ReplyDeleteselenium architecture
advantages of angularjs
aws certification benefits
android oreo update
aws interview questions and answers
devops interview questions and answers
Amazing..! I was impressed by your great post and Keep doing well...
ReplyDeleteMicrosoft Dynamics CRM Training in Chennai
Node JS Training in Chennai
Node JS Course in Chennai
Most helpful blog! It is the greatest comprehensive updates about this topic and Thank you for your sharing with us..!
ReplyDeleteAutomation Anywhere Training in Chennai
Automation Anywhere Online Training
VMware Training in Chennai
VMware Course in Bangalore
Automation Anyware Online Course
Amazing Post. keep update more information.
ReplyDeleteWeb Designing Course in chennai
web Designing Training in Chennai
Web Designing Course Online
อีกทั้งเรายังให้บริการ เกมสล็อต ยิงปลา แทงบอลออนไลน์ รองรับทุกการใช้งานในอุปกรณ์ต่าง ๆ HTML5 คอมพิวเตอร์ แท็บเล็ต สมาทโฟน คาสิโนออนไลน์ และมือถือทุกรุ่น เล่นได้ตลอด 24ชม. ไม่ต้อง Downloads เกมส์ให้ยุ่งยาก ด้วยระบบที่เสถียรที่สุดในประเทศไทย
ReplyDeleteหาคุณกำลังหาเกมส์ออนไลน์ที่สามารถสร้างรายได้ให้กับคุณ เรามีเกมส์แนะนำ เกมยิงปลา รูปแบบใหม่เล่นง่ายบนมือถือ คาสิโนออนไลน์ บนคอม เล่นได้ทุกอุปกรณ์รองรับทุกเครื่องมือ มีให้เลือกเล่นหลายเกมส์ เล่นได้ทั่วโลกเพราะนี้คือเกมส์ออนไลน์แบบใหม่ เกมยิงปลา
ReplyDeleteReally wonderful blog! Thanks for taking your valuable time to share this with us. Keep us updated with more such blogs.
ReplyDeleteAWS Course in Chennai
AWS Online Course
AWS Course in Coimbatore
ยูฟ่าเบท หรือ UFABET คือ เว็บให้บริการเดิมพันออนไลน์แบบครบวงจรโดยไม่ผ่านเอเย่นต์หรือตัวแทนใดๆ ซึ่งมีเกมและกีฬาให้เลือกเดิมพันมากมายหลากหลายประเภท รวมไปถึงคาสิโนออนไลน์หลายชนิด UFABET ถือได้ว่าเป็นเว็บไซต์ให้บริการเดิมพันออนไลน์ที่ผู้คนส่วนใหญ่นิยมใช้บริการ เพราะด้วยรูปแบบเว็บไซต์ที่ใช้งานง่ายและไม่จำเป็นต้องทำความเข้าใจอะไรเยอะ ประกอบกับเว็บนี้ยังรองรับการใช้งานในหลายๆภาษา ทั้ง จีน ฮ่องกง ไทย อังกฤษฯ จึงทำให้ผู้ใช้งานส่วนใหญ่ทั้งหน้าใหม่หรือหน้าเก่าต่างเลือกที่จะหันมาใช้บริการกับทาง ยูฟ่าเบท มากขึ้น จึงเป็นเว็บเดิมพันออนไลน์ที่ดีที่สุดในภูมิภาคเอเชีย ufa
ReplyDeleteThis blog is a great source of information which is very useful for me.
ReplyDeletegraphic design courses in tambaram
graphic design courses in Porur
graphic design courses in Chennai
Baccarat is money making and it's outstanding accessibility. The best In your case it's found that you'll find rather fascinating choices. And that is considered to be a thing that's rather different And it's very something that's rather happy to strike with The most wonderful, as well, is a very good alternative. Furthermore, it's a truly fascinating alternative. It's the simplest way which could generate profits. Superbly prepar The variety of best earning baccarat is the accessibility of generting by far the most cash. Almost as possible is so suitable for you A substitute which can be assured. To a wide variety of efficiency and availability And find out excellent benefits as well.บาคาร่า
ReplyDeleteufa
ufabet
แทงบอล
แทงบอล
แทงบอล
pgslot ซึ่งเกมคาสิโนออนไลน์เกมนี้เป็นเกมที่เรียกว่าเกม สล็อตเอ็กซ์โอ คุณรู้จักเกมส์เอ็กซ์โอหรือไม่ 90% ต้องรู้จักเกมส์เอ็กซ์โออย่างแน่นอนเพราะในตอนนี้เด็กนั้นเราทุกคนมักที่จะเอาก็ได้ขึ้นมา สล็อต เล่นเกมส์เอ็กซ์โอกับเพื่อนเพื่อนแล้วคุณรู้หรือไม่ว่าในปัจจุบันนี้เกมส์เอ็กซ์โอนั้นกลายมาเป็นเกมซะลอสออนไลน์ที่ให้บริการด้วยเว็บคาสิโนออนไลน์คุณสามารถเดิมพันเกมส์เอ็กซ์โอกับเว็บคาสิโนออนไลน์ได้โดยที่จะทำให้คุณนั้นสามารถสร้างกำไรจากการเล่นเกมส์เดิมพันออนไลน์ได้เราแนะนำเกมส์ชนิดนี้ให้คุณได้รู้จักก็เพราะว่าเชื่อว่าทุก
ReplyDeleteInfycle Technologies offers the Best Data training in chennai and is widely known for its excellence in giving the best Data Science Certification course in Chennai. Providing quality software programming training with 100% placement & to build a solid career for every young professional in the software industry is the ultimate aim of Infycle Technologies. Apart from all, the students love the 100% practical training, which is the specialty of Infycle Technologies. To proceed with your
ReplyDeletecareer with a solid base, reach Infycle Technologies through 7502633633.
This blog is a great source of information which is very useful for me.
ReplyDeleteAWS Training in Tambaram
AWS Training in Anna Nagar
AWS Training in Velachery
AWS Training in Tnagar
AWS Training in Porur
AWS Training in OMR
AWS Training in Chennai
Did you want to set your career towards Oracle? Then Infycle is with you to make this into reality. Infycle Technologies gives the combined and best Oracle course in Chennai, which offers various stages of Oracle such as Oracle PL/SQL, Oracle DBA, etc., along with 100% hands-on training guided by professional tutors in the field. Along with that, the mock interviews will be given to the candidates to face the interviews with complete confidence. Apart from all, the candidates will be placed in the top MNC's with an excellent salary package. To get it all, call 7502633633 and make this happen for your happy lifeBest Oracle Course in Chennai | Infycle Technologies
ReplyDeleteit was so good to read and useful to improve my knowledge as updated one, keep blogging…
ReplyDeleteJava Training in Tambaram
java course in tambaram
java training in velachery
java training institute in velachery
java training in anna nagar
java training in t nagar
java training in porur
java training in OMR
Java training in chennai
Great post. keep sharing such a worthy information
ReplyDeleteBig data training in chennai
Big Data Course in Chennai
Great post. It is really helpful for me.keep sharing such a worthy information..
ReplyDeleteWeb Development courses in Chennai
Infycle Technologies, the best software training institute in Chennai offers the leading Python course in Chennai for tech professionals, freshers, and students at the best offers. In addition to the Python course, other in-demand courses such as Data Science, Cyber Security, Selenium, Oracle, Java, Power BI, Digital Marketing also will be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.
ReplyDeletegreat blog. really inspiring.
ReplyDeleteRanorex Test Automation Online Training
Great blog.thanks for sharing such a useful information
ReplyDeleteQTP Training
Whereas we appreciate the fact that there is a myriad of situations that may crop up any minute, we pride ourselves on the fact that our employees are endowed with problem-solving skills. They are people who think on their feet. top security companies in London
ReplyDeleteThey can assess a situation very fast and act appropriately depending on how things unfold and protect you even in extreme or unexpected situations.
Nice blog to read. Thanks.
ReplyDeleteFull Stack Developer Online Training
Full Stack Online Course
Happy to read the informative blog. Thanks for sharing
ReplyDeletebest german language institute in chennai
best german classes in chennai
Infycle Technologies offers couples for care and technology in addition to Python Training in Chennai, 100% of the internship class will be prepared. After completing the training, the participants will be sent to the upper MNCs interviews. Call 750633333 to get more information and get a free display.
ReplyDeleteGreat post. Thanks for sharing such a useful blog.
ReplyDeleteSoftware testing training in Porur
Software testing training in chennai
Great info. Thanks.
ReplyDeleteHowever, you need delimiters around the trigger name e.g.
SET @SQL='Drop Trigger [' + @TriggerName + ']'
Otherwise may fail.
Great post. keep sharing such a worthy information.
ReplyDeleteRPA Training in Chennai
RPA Training Online
RPA Training In Bangalore