SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 11th, 2004, 01:41 PM
plasma800 plasma800 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Houston
Posts: 407 plasma800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 13 m 36 sec
Reputation Power: 5
Send a message via Yahoo to plasma800
Need Quick Education On SQL Bit Field...

I'm just making sure that I'm using a bit field correctly..

in SQL Server, my first question IS :
The Bit field is looking for a value of?

My 1st assumption is 1 or 0 right? 1 = true, 0=false?

Second, when updating the fields with an SQL update or insert, you just simply set it to 1 or 0?

somebitfield=1 -- and not somebitfield='1' or somebitfield='true'?

Also, for future reference... when I first created these bit fields in an existing table, i ran into the problem that as I had exisitng records, and a bit field does not allow a null, it wouldn't let me create the field as they were empty.. so I first made them varchar, entered a 1 into each column(i only have 5 test records at the moment) and then went back and changed em to a bit field. Surely there has to be a way around that???

THankx, happy easter everyone!

Reply With Quote
  #2  
Old April 12th, 2004, 12:52 AM
dip dip is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 11 dip User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi

Hello plasma,
Q:The Bit field is looking for a value of?
A:either a 1 or a 0.

Q:when updating the fields with an SQL update or insert, you just simply set it to 1 or 0?
A:Valid somebitfield=1 and not somebitfield='1'
InValid somebitfield='true'

Sorry i cant say much about your 'future reference'. i will getback u after some time


Desc about bit :
Consists of either a 1 or a 0. Use the bit data type when representing TRUE or FALSE, or YES or NO. For example, a client questionnaire that asks if this is the client's first visit can be stored in a bit column

waiting 4 your kind response
dipit

Reply With Quote
  #3  
Old April 12th, 2004, 01:05 AM
dip dip is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 11 dip User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up hello

hi
i wait some more info and i wait you to check this,

Also, for future reference... when I first created these bit fields in an existing table Which data type it was , i ran into the problem that as I had exisitng records, and a bit field does not allow a null Sorry, but if allows. it allow 1,0,null, it wouldn't let ......!!!!!!!!!!!!!!!!!!

dipit

Reply With Quote
  #4  
Old April 12th, 2004, 01:36 AM
plasma800 plasma800 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Houston
Posts: 407 plasma800 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 13 m 36 sec
Reputation Power: 5
Send a message via Yahoo to plasma800
For instance, say we have an existing table with 10 rows..

and now you need to add a bit field to make some true or false decision about that record when called..

If you now went and created that bit field, enterprise manage gets pissed.. cause it doesnt allow nulls, but tries to add the bit field to each record.. but of course has no idea what to fill it with..

is there a way to tell Ent Manager, to go ahead and fill each field with either a one or a zero.. and then you can put forth the effort of making each correct...

Reply With Quote
  #5  
Old April 12th, 2004, 10:12 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
To get around the problem of creating a bit field after the fact, you need to set a default value to the bit field when you create it, usually 0. Then it will work.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Need Quick Education On SQL Bit Field...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT