简体   繁体   English

Azure Synapse 无法将多行插入到表中

[英]Azure Synapse unable to insert multiple rows into table

I created a query that would insert multiple rows to a table but i can't make it work.我创建了一个查询,该查询将向表中插入多行,但我无法使其工作。

INSERT INTO bat_report (
  foldername, transactioncode, reporteddate
) 
VALUES 
  ('01202022', '00002762', '20220113-13:54:27'), 
  ('01202022', '00002762', '20220113-13:54:27')

based on what i searched online on how to insert multiple rows to table but can't seem to find the error根据我在网上搜索的关于如何在表中插入多行但似乎找不到错误的内容

Started executing query at Line 1 Parse error at line: 5, column: 48: Incorrect syntax near ','.在第 1 行开始执行查询 第 5 行第 48 列解析错误:“,”附近的语法不正确。 Total execution time: 00:00:03.339总执行时间:00:00:03.339

错误截图

  1. use 'select' statement instead of 'values' statement.使用“选择”语句而不是“值”语句。

insert into tb_test01(userid, username)插入 tb_test01(用户 ID,用户名)

select '1','a' select '1','a'

union all联合所有

select '2','b' select '2','b'

  1. Considering performance, please use bulk loading instead of singleton INSERTS if you need to load many rows.考虑到性能,如果您需要加载多行,请使用批量加载而不是 singleton INSERTS。 Please check this document for more information which has following details:请查看此文档以获取更多信息,其中包含以下详细信息:

Group INSERT statements into batches将 INSERT 语句分组为批处理

A one-time load to a small table with an INSERT statement or even a periodic reload of a look-up may perform just fine for your needs with a statement like INSERT INTO MyLookup VALUES (1, 'Type 1').使用 INSERT 语句一次性加载到小表,甚至定期重新加载查找,使用 INSERT INTO MyLookup VALUES (1, 'Type 1') 之类的语句可能会很好地满足您的需求。 However, if you need to load thousands or millions of rows throughout the day, you might find that singleton INSERTS just can't keep up.但是,如果您需要全天加载数千或数百万行,您可能会发现 singleton INSERTS 无法跟上。 Instead, develop your processes so that they write to a file and another process periodically comes along and loads this file.相反,开发您的进程,以便它们写入文件并且另一个进程定期出现并加载该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM