如何在sql server 2008中批量更新

发布于 2024-12-14 04:11:42 字数 397 浏览 4 评论 0原文

我有一个包含 10000 条记录的表,现在我添加了用于放置明文密码的字段,所以现在我想更新所有记录,但应该根据用户名更新新字段...如下所示。

update users set secdetail = case when username = 'abbas' then 'abbas@123' .... end

我正在使用 sqlcommand 从 .net 代码运行此查询,每当我在加载一段时间后尝试刷新页面时,我都会收到一条消息,提示“

The query processor ran out of stack space during query optimization. Please simplify the query

请帮忙”。

i have a table which contains 10000 records, now i have added the field for placing the plaintext password, so now i want to update all the records, but should update the new field on the basis of the username... like below.

update users set secdetail = case when username = 'abbas' then 'abbas@123' .... end

i am running this query from .net code, using sqlcommand, whenever i try to refresh the pagem after loading for sometime, i gets a message saying,

The query processor ran out of stack space during query optimization. Please simplify the query

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守不住的情 2024-12-21 04:11:42

为什么不在 .net 代码中创建一个循环来生成由分号分隔的正确 sql 更新语句

Update Users Set Secdetail = 'abbas@123' Where Username = 'abbas';
Update Users Set Secdetail = 'bbbas@123' Where Username = 'bbbas';
Update Users Set Secdetail = 'cbbas@123' Where Username = 'cbbas';
...

Why not create a loop in your .net code to produce proper sql update statements separated by semicolins

Update Users Set Secdetail = 'abbas@123' Where Username = 'abbas';
Update Users Set Secdetail = 'bbbas@123' Where Username = 'bbbas';
Update Users Set Secdetail = 'cbbas@123' Where Username = 'cbbas';
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文