How can the query results include null if it's a required field on the front end?

I executed a query that simply asked for all data points on a single table.

I am trying to figure out why the query would report back as having all "Null" values in 3 of 10 columns. The information is required for the end user to enter before the system allows them save a record.
March 27th, 2015 1:15pm

The "constraint" may be applied via the application code and not on the SQL Server Table.  This is fine for users who only access the database via a front end, but not if users are accessing the database by other means.

Check the Table itself to see if the columns allow null values.

Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 1:18pm

Sorry the question is vague. Are you sure the data exists in the table? Are you using some kind of outer join sysntax? If yes, then it will return NULL values if it cant find matches.

If this is not what you were asked please elaborate on the issue

March 27th, 2015 1:19pm

I am not sure where or what the application code is. Under properties the columns are listed followed by (Fk, int, null). There is also something that says Allow Null (True) This is the only thing that says true under focus code.
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 3:18pm

Because the constraint is FK,int,null this means that null are allowed. When you change this to FK,int, not null then the null is not allowed.

March 27th, 2015 3:20pm

Ok thanks. Will that produce the true responses chosen for the data already collected? Meaning if I am looking for services provided last year already documented in the database will I now the true value and not NULL. For example, What I was getting was the date, doctor, patient but I was not getting the service code or focus code which on the front end is a word (i.e. physical) after I have made this change will "physical" show up instead of "NULL".Also does "int" mean integer because that leads me to believe like other tables that give an integer there is another table that tells me what that integer stands for except I have looked in all the tables and that's no where to be found.  


Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 3:34pm

The reason it give you back a null instead of physicall, is because I think the table can not find the code that belongs to the int (integer). In this case you still have have null or unknown cell.  If you can not find the int (code) in a table to explain what the name is, then the issue remains.

Therefore look for the table where the int is joined to, this way you will get the translaiton for the int, as I understand that translation will appear in the line with patient, doctor en service name/focus code.

Regards,

Reshma

March 27th, 2015 4:07pm

ok thanks
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2015 4:10pm

Hi,

Please mark your question as answered, if the answer is satisfying.

Regards,

Reshma

March 28th, 2015 3:33am

Question: I found the table that gives the description of the value/int. for each service but:

How can I help the GROUPS table  find the code in the DDValue table that belongs to the int (integer) so that it will not say null or unknown cell".


Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 3:07pm

Hi,

Did you try to find the code that gives you back the NULL in the table? Does it give a description back? If yes, check the join of the the tables, it is possible that the join is not correct therefore no description is fount and it gives you a NULL.

If no,  and you can not find the code in the table, then maybe the wrong table is joined, you need to check which table gives you the correct description of the code.

Regards,

Reshma

March 30th, 2015 3:21pm

Not sure what all that means. The code associated with the table the gives the value/description is below. This is just one piece its kinda the same thing repeated for each data point.

ALTER TABLE [dbo].[IndividualService]  WITH CHECK ADD  CONSTRAINT [FK_IndividualService_DDLValues2] FOREIGN KEY([ServiceCode])

REFERENCES [dbo].[DDLValues] ([DDLValueID])

GO

The code for the table that has Null values/Unknowns is below again it is one piece.

ALTER TABLE [dbo].[IndividualService]  WITH CHECK ADD  CONSTRAINT [FK_IndividualService_DDLValues2] FOREIGN KEY([ServiceCode])
REFERENCES [dbo].[DDLValues] ([DDLValueID])
GO

Free Windows Admin Tool Kit Click here and download it now
March 30th, 2015 4:02pm

If I understand it correctly the IndivudualService table had the null value?

It references to DDLValues, that had the desc of the service code.

When you look up de service code do you get an description from table DDLValues?Thats the first check.

If the service code is not in the table, there should be an analyse where the code comes from. If the service code is in there, you should check why de ID is not correct.

Still we can be a better help if you post your whole code for these tables. As only a part is still not clear for me, where it goes wrong.

Regards,

Reshma

March 31st, 2015 1:48am

Hi

To make sure that data is not not, you should set the columns to be NOT NULL in your schema, and you should not rely on the fact that UX will stop the user.

It might be a simple bug in the UX that passes in NULL.

Regards

Aram

Free Windows Admin Tool Kit Click here and download it now
March 31st, 2015 1:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics