sql - 使用 SSMS 查询窗口执行大批量插入
问题描述
如果没有人/没有其他人正在访问系统,是否可以通过执行写入 SQL 查询窗口的一堆 INSERTS 来执行大批量、顺序插入,如下所示?
我在一组考试和分数插入中对其进行了测试,并且它有效。
(1 row affected)
(1 row affected)
但我不确定它是否会导致在查询窗口中一次执行所有这些问题。
或者这会导致问题吗?
--insert exam
INSERT INTO exam.exam (id, title) VALUES (NEXT VALUE FOR exam.nextid, 'Myth & Legends');
--insert score using the 'id' above
INSERT INTO exam.scores(examId, baseUrl, assessmentSize, tag)
SELECT current_value ,
'https://storage.googleapis.com/school-assessments',
101,
'Myth & Legends'
FROM sys.sequences WHERE schema_id = 9
--insert exam
INSERT INTO exam.exam (id, title) VALUES (NEXT VALUE FOR exam.nextid, 'Political Abstraction');
--insert score using the 'id' above
INSERT INTO exam.scores(examId, baseUrl, assessmentSize, tag)
SELECT current_value,
'https://storage.googleapis.com/school-assessments',
101,
'Political Abstraction'
FROM sys.sequences WHERE schema_id = 9
解决方案
推荐阅读
- c# - Unity 2D addforce 对象的随机方向
- vsto - 在没有管理员的情况下写入事件日志
- recursion - 具有递归类的 ocl 约束
- c++ - 如何在 C++ 中将整数常量乘以分数对象
- java - 检查 # 是偶数还是奇数,然后说出有多少项并得到打印的所有输出值的总和
- javascript - jQuery点击打开引导模式并更改选择选项
- java - 如何停止连续扫描二维码?
- git - 如果 master 现在坏了,如何将旧分支的更改应用到 master?
- docker - 如何对 yaml 文件中定义的不同服务强制执行启动顺序?
- xamarin.forms - 创建 Xamarin.Forms 项目时缺少 NETStandard.Library