Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 5.x > Installation and deployment > no NULL in database View modes: 
User avatar
Member
Member
gabbadeluxe-xD-hotmail - 8/16/2010 3:32:45 AM
   
no NULL in database
I have a problem.

Kentico always write an empty string in database, but I need a NULL there.

I would know how i can change that.

can somebody helps me ?



User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/16/2010 7:23:04 AM
   
RE:no NULL in database
Hi,

It depends on the field type. What DB table do you mean? Is it some system table or custom table?

Best regards,
Juraj Ondrus

User avatar
Member
Member
AKtoreee - 8/16/2010 7:48:03 AM
   
RE:no NULL in database
Its a custom Table with allow NULL enabled.

best regards

User avatar
Member
Member
AKtoreee - 8/17/2010 3:43:12 AM
   
RE:no NULL in database
Sorry I have forgotten to say that I have changed my nickname. I hope you are not confused. can you help me now ?

Best regards

L. HUMMER

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/17/2010 8:20:55 AM
   
RE:no NULL in database
Hi,

Why do you need exactly the NULL value? If you need it in some statement, you can check easily for empty string value as well as for NULL value.

Anyway, in this case you need to use custom data handler where in one of the events you will set NULL values for fields you need to. I am sorry for this inconvenience.

Best regards,
Juraj Ondrus

User avatar
Member
Member
AKtoreee - 8/18/2010 1:15:25 AM
   
RE:no NULL in database
I need the Null because I have a document type where you have a Homepage field. and in the query repeater there is a href link, but when the hompage field empty is, there should be an NULL in Database because then he make no link.

I hope you unterstand. because my englisch is not the best englisch.

best regards

L. hummer

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/18/2010 3:08:45 AM
   
RE:no NULL in database
Hi,

I think I understood, but still you can check in the SQL query the empty string, for example:

WHERE <fieldname> = ''

or, of it is on application level in the transformation, you can create a custom function and in it check the String.IsEmptyOrNull property.

Best regards,
Juraj Ondrus

User avatar
Member
Member
AKtoreee - 8/19/2010 2:48:57 AM
   
RE:no NULL in database
I have found it !

I changed the SQL statements and now its perfect . :)

Thanks a lot

best regards

L hummer