In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how mssql replaces the entire database in batches". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how mssql replaces the entire database in batches".
Declare cur cursor FOR
SELECT name,id FROM sysobjects WHERE xtype=U
Open cur
Fetch next FROM cur INTO @ tableName,@tbID
While @ @ fetch_status=0
Begin
Declare cur1 cursor FOR
-- xtype in (231, 167, 239, 175, 99) is of char,varchar,nchar,nvarchar,ntext type.
SELECT name FROM syscolumns WHERE xtype IN (231, 167, 239, 175, 99) AND
Open cur1
Fetch next FROM cur1 INTO @ columnName
While @ @ fetch_status=0
Begin
SET @ sql=update [+ @ tableName +] set [+ @ columnName+] = replace (cast ([+ @ columnName+] as varchar (8000)), + @ Str1+,+@Str2+) where [+ @ columnName+] like
Statements like update tablename set fieldA=replace (cast (fieldA as varchar (8000)), aa,bb).
Exec sp_executesql @ sql
SET @ iRow=@@rowcount
SET @ iResult=@iResult+@iRow
IF @ iRow > 0
Begin
Print table:, column: + @ columnName+ is updated + convert (varchar (10), @ iRow) + records
End
Fetch next FROM cur1 INTO @ columnName
End
Close cur1
Deallocate cur1
Fetch next FROM cur INTO @ tableName,@tbID
End
Print has a total of + convert (varchar (10), @ iResult) + records updated!
Close cur
Deallocate cur
SET nocount off
Thank you for reading, the above is the content of "how mssql replaces the entire database in batches". After the study of this article, I believe you have a deeper understanding of how mssql replaces the entire database in batches, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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: 0
*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.