'how to copy csv data into an existing sql table

I have an existing table that needs to be updated every night. The update is going to be from a CSV file into the table. I tried the following commands and I see this message every time -

BULK INSERT dbo.find_tbl
FROM 'data.csv'
WITH (DATA_SOURCE= 'xyz_datalake_net')
GO

or

COPY INTO dbo.find_tbl
FROM 'https://xyz.windows.net/files/data.csv'
WITH (
    FILE_TYPE = 'CSV'
)

I always get the error message: 'dbo.find_tbl' is not a user table. Cannot perform SET operation.

What can be done to fix this? Are external tables the issue?



Solution 1:[1]

error message: 'dbo.find_tbl' is not a user table. Cannot perform SET operation.

Description of an error: not a user table cannot perform set operation

Only table objects can utilize the SET options. Try to disconnect the server and reconnect it. The issue may be because of connection to the server.

how to copy csv data into an existing sql table

In Synapse SQL, the COPY statement is the most versatile and safe approach to bulk load data.

The following authentication mechanisms are available for CSV file types:

  1. Storage account key with LF as the row terminator

  2. Shared Access Signatures (SAS)

  3. Managed Identity

  4. Azure Active Directory Authentication

  5. Service Principal Authentication

For more information you can refer this Securely load data using Synapse SQL

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PratikLad-MT