異端な開発者を許ぃたってチョ☆

異端な開発者=尾画茶の記事

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  26  : 記事  0  : コメント  194  : トラックバック  3

ニュース

ブログは初めて & よーわからん & 苦手です…… ルールがわかっていないので、ご無礼してしまったときはお許しください。

書庫

日記カテゴリ

コミュニティー

ブックマーク

初心者向け

データベースは、SQL Server しかよく知らないので、他の製品はどうかわからないけれど、Bitってつかいにくいな、と今まで思っていた。

Management Studio でも、編集画面だと、True、False で現われ、0とか1とか入力すると怒られ、True、Falseで編集しなければならないのに、他の場面では 0,1 で扱わねばならない。

Convert や Cast を使わずに、どれほど正確に Bit として認識してくれるのか、実験してみた。

ストアドプロシージャーの引数に、Bit を設定してみる。こんな風に。

CREATE PROCEDURE TEST1 @a Bit AS SELECT @a

で、引数の @a に色々と渡してみる実験。

当然のことながら、0、1は突破。'0'、'1'でも、問題なし。これくらいは当たり前。しかし、ここからがなかなか賢くて「おおっ」と思わせてくれた。

0以外の数字なら、すべて 1になる。''で囲っても同じだ。大文字と小文字を混在しても、'FaLsE'とか'tRUe'とか、それぞれ0、1と扱ってくれる。

これはやってて知ったのだが、SQL SERVER にも、TRUE、FALSEという予約語のようなものがあるらしく、''で囲わずに、TRUE、FALSEでも認識してくれる。

そして、空文字列の場合…… 0にしてくれる。これはかなり、ありがたい。NULLのときは、NULL。これは当たり前。

つまり、かなり柔軟に受け止めてくれるということだ。'TRUE'、'FALSE'以外の文字列(上記のように、大文字小文字は区別しない)だと、エラーとなる。

たぶん、無理だと思ってやったら、やっぱしだめだったのは、全角の数字。エラーになりました……

投稿日時 : 2009年2月11日 12:07

コメント

# re: SQL Server の Bit は賢い 2009/02/11 12:31 中 博俊
ただしパフォーマンス的に
convert(bit, 1)を使いましょう

# re: SQL Server の Bit は賢い 2009/02/11 12:46 尾画茶
中さん、コメントありがとうございます。
1ではなくて、convert(bit, 1)ですか。
Books Online には、「1、0、または NULL の値をとる整数型です。」とあるのですが。

もうひとつ、発見。TRUE、FALSE、UNKNOWN ですが、UNKNOWN はBit に変換できません。しかも、エラーメッセージは、
「データ型 nvarchar を bit に変換中にエラーが発生しました。」
ということなので、内部的には、sysname(nvarchar)を使っているようです。

# doxylin https://doxycyline1st.com/
doxycycline 2022/02/26 0:28 Jusidkid
doxylin https://doxycyline1st.com/
doxycycline

# clomid for sale https://clomiden.fun/ 2022/04/12 12:46 Clomids
clomid for sale https://clomiden.fun/

# prednisone otc price https://prednisoneus.shop/ 2022/04/16 22:40 Prednisone
prednisone otc price https://prednisoneus.shop/

# lasix 40 mg https://buylasix.icu/
lasix 2022/06/24 16:58 LasixRx
lasix 40 mg https://buylasix.icu/
lasix

# clomid uk https://clomidonline.icu/ 2022/07/08 13:26 Clomidj
clomid uk https://clomidonline.icu/

# best erection pills https://ed-pills.xyz/
top rated ed pills 2022/09/17 7:39 EdPills
best erection pills https://ed-pills.xyz/
top rated ed pills

# odering doxycycline https://buydoxycycline.icu/ 2022/10/08 11:49 Doxycycline
odering doxycycline https://buydoxycycline.icu/

#  https://clomidforsale.site/ 2022/11/13 14:16 ForSale
https://clomidforsale.site/

# where can i buy prednisone https://prednisonepills.site/
buying prednisone from canada 2022/11/30 0:46 Prednisone
where can i buy prednisone https://prednisonepills.site/
buying prednisone from canada

# Get warning information here. Get warning information here.
https://edonlinefast.com
earch our drug database. Comprehensive side effect and adverse reaction information. 2023/02/18 0:55 EdOnline
Get warning information here. Get warning information here.
https://edonlinefast.com
earch our drug database. Comprehensive side effect and adverse reaction information.

# pain meds without written prescription - https://cheapdr.top/# 2023/04/03 2:26 Dikolipo
pain meds without written prescription - https://cheapdr.top/#

# doxycycline prices - https://doxycyclinesale.pro/# 2023/04/21 17:30 Doxycycline
doxycycline prices - https://doxycyclinesale.pro/#

# order cytotec online - https://cytotecsale.pro/# 2023/04/29 4:52 Cytotec
order cytotec online - https://cytotecsale.pro/#

# prednisone 10 mg online https://prednisonepills.pro/# - prednisone otc price 2023/06/04 21:29 Prednisone
prednisone 10 mg online https://prednisonepills.pro/# - prednisone otc price

# cheapest ed pills online https://edpill.pro/# - ed pills otc 2023/06/27 14:45 EdPills
cheapest ed pills online https://edpill.pro/# - ed pills otc

# Paxlovid over the counter https://paxlovid.store/
paxlovid generic 2023/07/13 13:20 Paxlovid
Paxlovid over the counter https://paxlovid.store/
paxlovid generic

# п»їonline apotheke 2023/09/26 12:37 Williamreomo
https://onlineapotheke.tech/# online apotheke deutschland
versandapotheke

# versandapotheke deutschland 2023/09/26 23:25 Williamreomo
http://onlineapotheke.tech/# gГ?nstige online apotheke
online apotheke gГ?nstig

# internet apotheke 2023/09/27 4:09 Williamreomo
http://onlineapotheke.tech/# online apotheke deutschland
п»?online apotheke

# п»їonline apotheke 2023/09/27 4:34 Williamreomo
https://onlineapotheke.tech/# versandapotheke versandkostenfrei
internet apotheke

# online apotheke preisvergleich 2023/09/27 5:48 Williamreomo
http://onlineapotheke.tech/# online apotheke deutschland
online apotheke deutschland

# п»їonline apotheke 2023/09/27 6:14 Williamreomo
https://onlineapotheke.tech/# versandapotheke deutschland
п»?online apotheke

# п»їonline apotheke 2023/09/27 7:04 Williamreomo
https://onlineapotheke.tech/# versandapotheke
internet apotheke

# online apotheke gГјnstig 2023/09/27 7:34 Williamreomo
https://onlineapotheke.tech/# online apotheke preisvergleich
versandapotheke

# farmacie online sicure 2023/09/27 17:37 Rickeyrof
acheter sildenafil 100mg sans ordonnance

# online mexican pharmacies 2023/10/16 13:04 Dannyhealm
Offering a global gateway to superior medications. https://mexicanpharmonline.shop/# pharmacies in mexico that ship to usa

# canadian online drug store 2023/10/16 17:15 Dannyhealm
I'm always impressed with their efficient system. https://mexicanpharmonline.shop/# reputable mexican pharmacies online

# canadian mail order medications 2023/10/16 21:52 Dannyhealm
Appreciate their commitment to maintaining global healthcare standards. https://mexicanpharmonline.shop/# mexico drug stores pharmacies

# how to get a prescription in canada 2023/10/16 23:44 Dannyhealm
Their medication reminders are such a thoughtful touch. http://mexicanpharmonline.com/# mexican pharmaceuticals online

# canadian pharmacies that deliver to the us 2023/10/17 3:08 Dannyhealm
Leading with compassion on a global scale. https://mexicanpharmonline.shop/# mexican rx online

# order prescription from canada 2023/10/18 2:13 Dannyhealm
They are always proactive about refills and reminders. http://mexicanpharmonline.shop/# mexican pharmaceuticals online

# top mail order pharmacies 2023/10/18 7:21 Dannyhealm
They offer world-class service, bar none. http://mexicanpharmonline.com/# mexican rx online

# canada mail order prescriptions 2023/10/18 8:32 Dannyhealm
A cornerstone of our community. http://mexicanpharmonline.com/# mexican pharmaceuticals online

# doxycycline 150 mg https://doxycycline.forum/ doxycycline pills 2023/11/25 13:21 Doxycycline
doxycycline 150 mg https://doxycycline.forum/ doxycycline pills

# ed medications https://edpill.cheap/ ed meds 2024/02/10 0:33 EdPills
ed medications https://edpill.cheap/ ed meds

# eva elfie izle https://evaelfie.pro/ eva elfie video 2024/03/03 10:28 EvaElfia
eva elfie izle https://evaelfie.pro/ eva elfie video

# abella danger izle https://abelladanger.online/ abella danger filmleri
2024/03/06 11:00 Adella
abella danger izle https://abelladanger.online/ abella danger filmleri


# sweetie fox video https://sweetiefox.pro/ - sweetie fox full video
2024/03/06 22:12 SwitieFox
sweetie fox video https://sweetiefox.pro/ - sweetie fox full video


# gates of olympus oyna - https://gatesofolympus.auction/ gates of olympus slot 2024/03/27 20:45 Olympic
gates of olympus oyna - https://gatesofolympus.auction/ gates of olympus slot

# sweet bonanza hilesi https://sweetbonanza.bid/ - sweet bonanza hilesi
2024/03/27 23:51 Bonanzaj
sweet bonanza hilesi https://sweetbonanza.bid/ - sweet bonanza hilesi


# pin-up bonanza: https://pinupgiris.fun/ pin up indir
2024/03/28 9:08 GirisUp
pin-up bonanza: https://pinupgiris.fun/ pin up indir


# prednisone price 2024/08/06 17:53 Stevenput
prednisone otc price http://prednisonebestprice.pro/# prednisone uk price
50mg prednisone tablet

# generic lasix 2024/08/20 13:04 DanielEruts
cytotec abortion pill https://cytotec.pro/# purchase cytotec
lasix

# furosemide 40mg 2024/08/21 3:09 DanielEruts
cytotec abortion pill https://tamoxifen.bid/# tamoxifen citrate
furosemide 100 mg

# furosemida 40 mg 2024/08/23 11:47 DanielEruts
buy cytotec over the counter https://tamoxifen.bid/# tamoxifen citrate pct
lasix generic

# lasix pills 2024/08/24 0:40 DanielEruts
cytotec buy online usa https://furosemide.win/# furosemide
lasix 40mg

# vavada зеркало 2024/09/04 18:00 Warrenpseut
http://vavada.auction/# vavada казино

# вавада зеркало 2024/09/06 0:15 Warrenpseut
http://vavada.auction/# вавада зеркало

# казино вавада 2024/09/07 5:31 Warrenpseut
https://1win.directory/# 1win вход

# gates of olympus oyna demo 2024/09/19 13:12 GeorgeMum
http://gatesofolympusoyna.online/# gates of olympus demo oyna

# farmacias online seguras 2024/09/21 13:52 FloydUnorm
http://farmaciaeu.com/# farmacia online envГ­o gratis
farmacia online barata

# sildenafilo 100mg farmacia 2024/09/22 3:28 DennisevElp
https://farmaciaeu.com/# п»?farmacia online espaГ±a

# sildenafilo precio farmacia 2024/09/23 9:18 DennisevElp
https://farmaciaeu.com/# farmacia barata

# farmacia online madrid 2024/09/23 12:25 FloydUnorm
http://farmaciaeu.com/# farmacias online seguras
farmacia barata

# farmaci senza ricetta elenco 2024/09/24 2:54 Charlesnub
https://tadalafilit.com/# farmacie online sicure
acquistare farmaci senza ricetta

# pharmacie en ligne 2024/10/03 21:44 StephenWadly
http://clssansordonnance.icu/# pharmacie en ligne fiable

# pharmacie en ligne france fiable 2024/10/05 13:57 StephenWadly
https://pharmaciepascher.pro/# acheter mГ©dicament en ligne sans ordonnance

# Clava is the best 2025/05/03 23:00 Danielthash
Fine news for all us

# Хендмейд объединяет поколения. Сохраняйте традиции и создавайте новые 2025/11/01 12:48 ArtisanMax
Ремесло - это когда вы создаёте не вещь, а эмоцию. Поделитесь ею с миром https://artisanalcrafts.ru/

# Создавайте с радостью! Новые техники, материалы и вдохновение - всё в одном месте 2025/11/02 19:57 ArtisanMax
Мастер-классы, идеи и лайфхаки для тех, кто ценит аутентичность и хочет творить сам https://artisanalcrafts.ru/

# Ремесло - это искусство быть здесь и сейчас. Попробуйте - это работает 2025/11/03 6:31 ArtisanMax
Хендмейд - это когда вы создаёте не для других, а для себя https://artisanalcrafts.ru/

Post Feedback

タイトル
名前
Url:
コメント