Solved

Cannot insert the value NULL into column "ColumnName", Column does not allow nulls - Designer

  • 20 February 2018
  • 6 replies
  • 237 views

I have been designing a mobile device tracking application for a few days. There is an object called "BroadbandDevice" with a bunch of properties, only one of them being required. The problem I am having is that when I try to set the value of property "Number" as empty, I get the following error: 15999i76D95E3FA3386E43.png

 

icon

Best answer by davidedpg10 20 February 2018, 19:56

View original

6 replies

Userlevel 5
Badge +16

Hi David,


 


Do you get the same error when you execute the smartobject from the smartobject tester tool?


What version of K2 are you using?


 


It seems you're using the smartbox service, can you access the K2 DB and generate a scrip of the table BroadbandDevice then attach it here?

I did run it through the SMO Services tester tool, and I had the same issue.

 

The version of K2 is actually very outdated, 4.6.11 to be exact. We are in the process of upgrading it to 4.7 but it won't happen until either end of this week or next week.

The insert script is as follows: 

INSERT INTO [K2Dev].[dbo].[BroadbandDevice]
([imei]
,[Number]
,[User]
,[sim]
,[personally_paid]
,[previous_user]
,[order_number]
,[date_activated]
,[date_assigned]
,[HW_billed_to]
,[Notes]
,[part_number]
,[Serial_Number]
,[inactive]
,[replaces])
VALUES
(<IMEI, nvarchar(100),>
,<Number, nvarchar(100),>
,<User, nvarchar(100),>
,<SIM, nvarchar(100),>
,<personally_paid, nvarchar(100),>
,<previous_user, nvarchar(100),>
,<order_number, nvarchar(100),>
,<date_activated, date,>
,<date_assigned, date,>
,<HW_billed_to, nvarchar(100),>
,<Notes, nvarchar(max),>
,<part_number, nvarchar(100),>
,<Serial_Number, nvarchar(100),>
,<inactive, nvarchar(100),>
,<replaces, nvarchar(100),>)
GO

in the SQL tablle itself I do see the option of whether to allow null or not, but it will not let me save it.

I'm not sure if it would have cause other issues if it did save, but that would allow it to have a null value.

SOLVED!!!
So apparently it was a weird bug where the SQL DB had Number as not allowing a NULL value, I went into the object, changed it to required, saved it, and then changed it to not required and saved again. That seems to have unset the SQL Database to allow Null value.

Badge +1
We have the same issue with the SO when trying to create a record in the DB ,the requirements is that a couple of Date Fields ( they are calculated fields in the DB) are required in the DB but we don't need to map them in the SO. Any suggestions ?
Userlevel 5
Badge +13

I think in this case you would need to use a stored procedure to insert the record, as K2 only sees the not null field and makes it required to be passed in.

Reply