By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,027 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,027 IT Pros & Developers. It's quick & easy.

SQL bit column default value

P: n/a
Using vs.2003, SQL native

1) I presume that the SQL bit data type is the equivalent of Boolean data
type in VS 2003. I have used it that way, and it works fine.

2) Given above, using Server Explorer, Design Table, what can I put in the
default field for FALSE for a bit data type column? The IDE accepts ('0')
and also (0) as OK (and fails on things like ('False') as I would expect)..
But when you create a new row and save it to the data source, it fails,
indicating you cannot write a null to that field (it is set up as
non-nullable). I use defaults as a way of avoiding nulls, but cannot figure
out the default for a bit filed.

Please give me the answer specifically for the Default Field in the Design
Table dialog box, what the exact entry would be. These fields often use
different
formats than SQL.

What works?

Bob Day
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You can enter 0 or 1

"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Using vs.2003, SQL native

1) I presume that the SQL bit data type is the equivalent of Boolean data
type in VS 2003. I have used it that way, and it works fine.

2) Given above, using Server Explorer, Design Table, what can I put in the
default field for FALSE for a bit data type column? The IDE accepts ('0')
and also (0) as OK (and fails on things like ('False') as I would expect).. But when you create a new row and save it to the data source, it fails,
indicating you cannot write a null to that field (it is set up as
non-nullable). I use defaults as a way of avoiding nulls, but cannot figure out the default for a bit filed.

Please give me the answer specifically for the Default Field in the Design
Table dialog box, what the exact entry would be. These fields often use
different
formats than SQL.

What works?

Bob Day

Nov 20 '05 #2

P: n/a
(0) always works for me, if you enter 0 by itself it's changed to (0) next
time you open design view.

I get no errors creating new rows without specifying values for these
fields.

Bob
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Using vs.2003, SQL native

1) I presume that the SQL bit data type is the equivalent of Boolean data
type in VS 2003. I have used it that way, and it works fine.

2) Given above, using Server Explorer, Design Table, what can I put in the
default field for FALSE for a bit data type column? The IDE accepts ('0')
and also (0) as OK (and fails on things like ('False') as I would expect).. But when you create a new row and save it to the data source, it fails,
indicating you cannot write a null to that field (it is set up as
non-nullable). I use defaults as a way of avoiding nulls, but cannot figure out the default for a bit filed.

Please give me the answer specifically for the Default Field in the Design
Table dialog box, what the exact entry would be. These fields often use
different
formats than SQL.

What works?

Bob Day

Nov 20 '05 #3

P: n/a
If doesn't work for me. If you use Sever Explorer, and display data, add a
row manually, it does work just fine.

If you add a row via DataAdapter, it fails. Is there some setting in
DataAdapter I am missing?

I will review my code to see.

Bob Day

"Bob Graham" <rv*****@pacbell.net> wrote in message
news:LZ*********************@newssvr21.news.prodig y.com...
(0) always works for me, if you enter 0 by itself it's changed to (0) next
time you open design view.

I get no errors creating new rows without specifying values for these
fields.

Bob
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Using vs.2003, SQL native

1) I presume that the SQL bit data type is the equivalent of Boolean data type in VS 2003. I have used it that way, and it works fine.

2) Given above, using Server Explorer, Design Table, what can I put in the default field for FALSE for a bit data type column? The IDE accepts ('0') and also (0) as OK (and fails on things like ('False') as I would

expect)..
But when you create a new row and save it to the data source, it fails,
indicating you cannot write a null to that field (it is set up as
non-nullable). I use defaults as a way of avoiding nulls, but cannot

figure
out the default for a bit filed.

Please give me the answer specifically for the Default Field in the Design Table dialog box, what the exact entry would be. These fields often use
different
formats than SQL.

What works?

Bob Day


Nov 20 '05 #4

P: n/a
If I don't want my code to set the field true, I don't even mention it in my
sqladapter's command text. If it is in the command text I set it to 0 if I
don't want it to be true. The point is, don't mention it, you're fine, do
mention it--> make sure to supply a value.

Bob
"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
If doesn't work for me. If you use Sever Explorer, and display data, add a row manually, it does work just fine.

If you add a row via DataAdapter, it fails. Is there some setting in
DataAdapter I am missing?

I will review my code to see.

Bob Day

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.