SQL Bulk data migration uniqueidentifier

Stephen Liang 21 Reputation points
2021-02-18T15:13:41.853+00:00

Ok . But encounter another problem. As i have 200 data rows to input , i noted i cannot bulk insert using ['] after each row, as error message [You must declare @id uniqueidentifier].

How can i solve this for multiple data rows migration for insertion?

thanks again

DECLARE @id uniqueidentifier
SET @id = NEWID()
insert into Records ([Id],Ref1,Ref2,Name1,Date1) values
(@id,'a','b','c',GETDATE()),
(@id,'a','b','c',GETDATE()),
(@id,'a','b','c',GETDATE()),
(@id,'a','b','c',GETDATE()),

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,644 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalv-MSFT 5,906 Reputation points
    2021-02-19T05:56:07.703+00:00

    Hi @Stephen Liang ,

    May I know if you want to use SSIS Execute SQL Task to run the Insert sql query?

    Please refer to Parameters in the Execute SQL Task and Execute SQL Task in SSIS: Output Parameters vs Result Sets.

    Best regards,
    Mona

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.