如何在高速公路上从SQL中删除数据

编程入门 行业动态 更新时间:2024-10-22 16:34:18
本文介绍了如何在高速公路上从SQL中删除数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 我想从一张表中删除近4个lac数据,表中有近10个lac 但是只有4个lac数据我想要删除。 但同时用户或在网站上使用sama数据库。 我试图删除但它对用户来说已经慢了 所以我删除了前1000名的记录。 如何在一次尝试中删除这4个lac而不会让用户变慢 请告诉我有什么选择吗? 谢谢

Hi I wants to delete nearly 4 lac data from one table which has nearly 10 lac in table But only 4 lac data i wants delete. But same time Users or using the sama data base in website. I tried to delete but it made dead slow for the user So Am deleting like top 1000 record . How can i delete this 4 lac in one attempt without making slow for user Please tell me is there any option ? Thanks

推荐答案

阅读以下内容: stackoverflow/questions/1522057/what-is-the-fastest-way-to -slete-massive-of-record-in-sql [ ^ ] Read the following : stackoverflow/questions/1522057/what-is-the-fastest-way-to-delete-massive-numbers-of-records-in-sql[^]

尝试批量删除行 Try to delete rows in batch declare @batchSize int declare @startValue int declare @endValue int declare @Counter int SET @batchSize = 100 SELECT = MIN (stockId) from t_core_stock SELECT @endValue = MAX (stockId) from t_core_stock SET @Counter = @startValue WHILE (@Counter <=@endValue) BEGIN DELETE t_core_stock WHERE StockID BETWEEN @Counter AND @batchSize SET @Counter = @Counter + @batchSize END

在你的表中,任何主键都在那里首先,您需要删除主键并删除记录,然后添加主键,如下所示。 Hi, In your table any Primary Key is there then first you need to Drop Primary Key and Delete the Records then Add Primary Key like as follows. ALTER TABLE <tablename> DROP CONSTRAINT <pkname> MAKE YOUR DELETE HERE ALTER TABLE <tablename> ADD CONSTRAINT <pkname> PRIMARY KEY (ColumnName>) </pkname></tablename></pkname></tablename>

问候, GVPrabu

Regards, GVPrabu

更多推荐

如何在高速公路上从SQL中删除数据

本文发布于:2023-10-29 08:07:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539166.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高速公路   数据   如何在   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!