我如何翻转SQL Server中的位? [英] How do I flip a bit in SQL Server?

查看:98
本文介绍了我如何翻转SQL Server中的位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在SQL Server不执行按位。我想要做这样的事情:

I'm trying to perform a bitwise NOT in SQL Server. I'd like to do something like this:

update foo
set Sync = NOT @IsNew

请注意:我开始写这一点,并找到了答案,以我自己的问题之前,我完成了。我仍然希望与社会各界分享,因为还缺乏这片文档在MSDN上(直到我把它添加到社区内容有,太)。

Note: I started writing this and found out the answer to my own question before I finished. I still wanted to share with the community, since this piece of documentation was lacking on MSDN (until I added it to the Community Content there, too).

推荐答案

是的,〜运营商将正常工作。

Yes, the ~ operator will work.

update foo
set Sync = ~@IsNew

这篇关于我如何翻转SQL Server中的位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆