NULL ISSUE IN EXTERNAL TABLE

Rohit Kulkarni 686 Reputation points
2024-04-10T14:55:19.2666667+00:00

Hello Team,

I have created a table and pass the null for all the columns .But still i am getting error .

CREATE EXTERNAL TABLE [Sh].[Dim]

( [col1] nvarchar NULL,

[col2] [int] NULL,

[col3] [int] NULL,

[col4] [int] NULL,

[col5] [int] NULL )

WITH (DATA_SOURCE = [RawAccessTypeAugmented], LOCATION = '/Dim/*.parquet', FILE_FORMAT = [Parque], REJECT_TYPE = VALUE, REJECT_VALUE = 0)

Please refer below the error :

Cannot insert the value NULL into column 'col', table 'QTable_11bb46bd660b479789ab1f65f3c80461_50'; column does not allow nulls. INSERT fails.

I am not able to understand, when i am passing the null value to all the column then why this issue is coming please let me know

Regards

rk

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,477 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Smaran Thoomu 10,880 Reputation points Microsoft Vendor
    2024-04-11T05:17:57.13+00:00

    Hi @Rohit Kulkarni

    Thanks for the question and using MS Q&A platform.

    Based on the error message you provided, it seems that the issue is with the table you created. The error message indicates that the column 'col' does not allow null values, which means that you cannot insert a null value into that column.

    To resolve this issue, you need to ensure that the column 'col' allows null values. You can modify the table schema to allow null values for this column by running the following command:

    
    ALTER TABLE [Sh].[Dim] ALTER COLUMN [col] nvarchar NULL;
    
    

    This command will modify the table schema to allow null values for the column 'col'. Once you have made this change, you should be able to insert null values into this column without any issues.

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.