In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
SQLServer2005 trigger prompts other sessions are using transaction solutions, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, hope you can gain something.
After a look on MSDN, it is said that sql server 2005 does not support the existence of local linked servers (loopback linked servers) in distributed transaction processing. Individuals try the following because they use chained access (LinkedServer mode) in two-way sql server access. In this case, you only need to use the statements that originally accessed each other's database:
The code is as follows: select * from linkedServerA.dbo.table1
Modified to:
The code is as follows: select * from dbo.table1
That's it.
The trigger code is as follows:
The code is as follows:
Create trigger tgr_dressNotice_inserton dress_notice_config
-with encrypion-encryption trigger
After insert-update level triggerasbegin-as raisError ('tgr_dressNotice_insert trigger triggered', 16,10)
/ * define variables * /
Declare @ sDBServer char (20)
/ * used to store the destination database * /
Declare @ sSql varchar declare @ server varchar declare @ oadb varchar select @ oadb=db_server from dic_organ where valid='1' and rank in and organ_id='000000' set @ server=rtrim (@ oadb) +. Dbo.spoa_exec_string'
/ * define cursor*/ declare db_cursor cursor for select db_server from dic_organ where valid='1' and rank in ('Achilles Magazine B') and organ_id'000000' / * open cursor*/ OPEN db_cursor FETCH NEXT FROM db_cursor INTO @ sDBServer while (@ @ Fetch_status = 0) begin
/ * synchronize the data to the database of each branch office * /
Set @ sSql='delete from'+ RTRIM (@ sDBServer) + '.dbo.dress_notice_config' print @ sSql exec @ sSql set @ sSql='insert into' + RTRIM (@ sDBServer) + '.dbo.dress_notice_config select * from dress_notice_config' print @ sSql exec @ server @ sSql FETCH NEXT from db_cursor into @ sDBServer end
-- finally close the cursor close db_cursor deallocate db_cursorendgo
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 233
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.