none
How to store Byte Array Null Value to SQL Database RRS feed

Answers

  • To be able to store NULL values in a database column the column must be defined to allow the insertion of NULL values. You specify this (NULL or NOT NULL) when you create (or update) the column in the database, using SQL code or by using some designer such as SQL Server Management Studio:

    --update existing column to allow NULL values:
    ALTER TABLE [YourTable] ALTER COLUMN [YourColumn] varbinary NULL

    You cannot insert NULL values into a column that is defined to not accept NULL values. This is not possible.

    However, how to modify the database is not a .NET Framework topic. If you have any further questions about anything related to the database, you should ask in the appropriate forums (SQL Sever questions goes here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver)

     

    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

    Friday, March 20, 2015 1:18 PM

All replies

  • We would need to see the Command you use to do it, also the DB-Engine you use is a helpful information.

    Friday, March 20, 2015 7:29 AM
  • To be able to store NULL values in a database column the column must be defined to allow the insertion of NULL values. You specify this (NULL or NOT NULL) when you create (or update) the column in the database, using SQL code or by using some designer such as SQL Server Management Studio:

    --update existing column to allow NULL values:
    ALTER TABLE [YourTable] ALTER COLUMN [YourColumn] varbinary NULL

    You cannot insert NULL values into a column that is defined to not accept NULL values. This is not possible.

    However, how to modify the database is not a .NET Framework topic. If you have any further questions about anything related to the database, you should ask in the appropriate forums (SQL Sever questions goes here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver)

     

    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

    Friday, March 20, 2015 1:18 PM