Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Data type for Gender Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, September 15, 2005 3:37 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Thursday, January 13, 2011 7:55 PM Points: 124, Visits: 12
 What is the recommended datatype for Gender?
Post #220408
 Posted Thursday, September 15, 2005 3:51 PM
 SSC-Addicted Group: General Forum Members Last Login: Today @ 9:14 AM Points: 415, Visits: 3,182
Post #220412
 Posted Thursday, September 15, 2005 4:31 PM
 UDP Broadcaster Group: General Forum Members Last Login: Tuesday, August 16, 2016 3:59 PM Points: 1,487, Visits: 1,076
 In reality its a boleeanso bit is fine just have to decide0 = Male, 1 = Femaleor 1 = Male, 0 = FemaleHow boutChar(1)M (Male)F (Female)U (Unknown)B (Both)
Post #220423
 Posted Thursday, September 15, 2005 4:49 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Thursday, January 13, 2011 7:55 PM Points: 124, Visits: 12
 Char(1) sound better. I think Boolean might give problems for NULL data.
Post #220428
 Posted Thursday, September 15, 2005 4:49 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Thursday, January 13, 2011 7:55 PM Points: 124, Visits: 12
 Char(1) sound better. I think Boolean might give problems for NULL data.
Post #220429
 Posted Friday, September 16, 2005 4:25 AM
 Hall of Fame Group: General Forum Members Last Login: Today @ 2:20 AM Points: 3,056, Visits: 3,778
 I would go for char(1).  Many poorer countries do not perform gender assignment surgery for those babies whose bits are not obvious.  Original author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2016, 2014, 2012, 2008 R2, 2008 and 2005. 29 Aug 2016: now over 38,000 downloads.Disclaimer: All information provided is a personal opinion that may not match reality.Quote: "When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist." - Archbishop Hélder Câmara
Post #220547
 Posted Friday, September 16, 2005 6:21 AM
 SSChampion Group: General Forum Members Last Login: Today @ 7:26 AM Points: 14,545, Visits: 38,406
 i typically use a char(1) with a check constraint to allow only two values:ie ALTER TABLE BLAH ADD GENDER CHAR(1) NULL CHECK (GENDER='M' OR GENDER='F') Lowell--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #220593
 Posted Friday, September 16, 2005 6:44 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Monday, February 9, 2015 7:07 AM Points: 199, Visits: 60
 varchar(1)Null is unknown. That is the purpose of null.>How bout>Char(1)>M (Male)>F (Female)>U (Unknown)>B (Both)
Post #220600
 Posted Friday, September 16, 2005 8:55 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Thursday, January 13, 2011 7:55 PM Points: 124, Visits: 12
 I see that char or varchar is recommended. Any reason to choose one over the other? What is the selection process to select char, varchar, nvarchar?
Post #220718
 Posted Friday, September 16, 2005 9:00 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Monday, February 9, 2015 7:07 AM Points: 199, Visits: 60
 Because of my indoctrination by Oracle DBAs, I use varchar and never use char.  The reason for nvarchar would be for international character purposes.  I have never seen a compelling reason to use char.
Post #220722

 Permissions