| Author |
Topic |
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-06 : 11:06:01
|
| Hey all,Sometimes when I create a DB and then a table, I define the fields and wont set any of them to null. Then when I go into the query analyzer and start adding data, one of the fields will say "NULL" and there is naff I can do about it... Does anyone else have this and no how to deal with it>? |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-06 : 11:11:21
|
| Can you give an example? I don't think sql server randomly goes about changing not null columns to nullable...-------Moo. :) |
 |
|
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-06 : 11:13:25
|
| Ok,I create a database, test.... create a table, userNameloginNamepassworddepartmentuserName as the primary key... none are null.When I go to enter data department will say "NULL" in it.... sounds so silly I know, but trust me I dont have null values checked anywhere, but it still says null :( really unhappy |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-06 : 11:26:59
|
| How are you creating the tables? Enterprise Manager? The default is allow nulls. Do you turn this off? What is the output from right-clicking on the table and generating the sql script for it?-------Moo. :) |
 |
|
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-06 : 11:35:55
|
| Yes I am creating in EM, I dont understand when you say right click the table and generate the script I cant see that... this is so weird. |
 |
|
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-06 : 11:42:10
|
Here are some screens if they help...  |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-08-06 : 13:08:02
|
| It won't let you save it until you change the value.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2004-08-07 : 04:58:00
|
| I think the problem is that when you open a table in QA for input, it won't let you edit text columns. When you add a new row, the only thing it will let you put in the text column is the default value, which is a bit of a bugger if there's no default set and the column isn't NULLable.If you put DEFAULT '' on your text column, QA will still display NULL before it saves the row, and it still won't let you enter any data in the column, but it will save the row with the default value of '' in that column. You won't be able see that while entering the data though, since it will show non-NULL text values as (...) |
 |
|
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-09 : 04:39:29
|
| so would it be better to use something other than text? nchar for example? |
 |
|
|
Pace
Constraint Violating Yak Guru
264 Posts |
Posted - 2004-08-10 : 10:02:03
|
easily corrected... simply my n00bishness |
 |
|
|
|