- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想将行从一个表移动到另一个表,delete from [foo] output deleted.[col] into [bar] (col)
看起来是个不错的选择。
但是这些列并不相同。因此,我想将一些硬编码值(理想情况下是通过编程确定的值)插入到目标表中。
我设置了几个表来演示。
create table delete_output_test (
thing1 int not null,
thing2 varchar(50),
thing3 varchar(50)
)
create table delete_output_test2 (
thing1 int not null,
thing2 varchar(50),
thing3 varchar(50),
thing4 int
)
insert into delete_output_test values (0, 'hello', 'world'),
(1, 'it''s', 'me'),
(2, 'i', 'was'),
(3, 'wondering', 'if')
现在,如果我不太需要的话,从一张 table 搬到另一张 table 就可以了......
delete from delete_output_test2
output deleted.thing1,
deleted.thing2,
deleted.thing3
into delete_output_test
(thing1,
thing2,
thing3)
但是如果我想填充最后一列怎么办?
delete from delete_output_test2
output deleted.thing1,
deleted.thing2,
deleted.thing3
into delete_output_test
(thing1,
thing2,
thing3,
4)
Incorrect syntax near '4'. Expecting '.', ID, PSEUDOCOL, or QUOTED_ID.
我是 SQL 的新手,所以我什至不确定那些东西是什么。
那么为什么我不能硬编码一个值来插入呢?如果我想变聪明的话,甚至可以用一些 select
语句替换 4
?
最佳答案
嗯,delete_output_test
没有名为 4
或 thing4
的列,但 delete_output_test2
有。所以你可以这样做:
delete from delete_output_test
output deleted.thing1,
deleted.thing2,
deleted.thing3,
4
into delete_output_test2
(thing1,
thing2,
thing3,
thing4);
select * from delete_output_test2;
rextester 演示:http://rextester.com/CVZOB61339
返回:
+--------+-----------+--------+--------+
| thing1 | thing2 | thing3 | thing4 |
+--------+-----------+--------+--------+
| 0 | hello | world | 4 |
| 1 | it's | me | 4 |
| 2 | i | was | 4 |
| 3 | wondering | if | 4 |
+--------+-----------+--------+--------+
关于sql - 插入删除的数据,加上一些硬编码值,输出语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45487962/
我已经搜索了对此的一种解释,但没有找到一种解释。在Prolog谓词的描述中,有时在变量名之前的问号,加号和减号是什么意思? 例: predicate(?Variable1,+Variable2,-Va
我正在尝试使用以下脚本 $(document).ready(function() { $('#item1_number_1').keyup(function() {
在下面的代码片段中考虑用注释的等价物替换第 8 行 1. private static String ipToText(byte[] ip) { 2. StringBuffer result = n
对于要在图表中显色的级别数要多的因子,我想用“其他”替换不在“前10名”中的任何级别。 替代问题:如何将因子水平降低到rcolorbrewer可以绘制为单独颜色的数量? 例如,如果我想从棒球数据中绘制
我想要一个通过 ssh 进入机器的命令,运行一个命令(cd 或执行脚本或 su),然后给我 shell。向 ssh 传递命令似乎总是退出。 我正在寻找的一些例子: 'ssh me@machine1 "
我正在尝试将引导工具提示附加到特定的全日历日 View td 元素。我可以从该元素上的 FC 单击事件获取 td 元素。如果我执行 console.dir(thing); 那么该元素将作为一个对象返回
我有一个脚本,应该循环遍历一系列 csv 文件以创建不同的有向图。当使用 matplotlib (plt.savefig()) 保存时,随着循环的进行,图表似乎会被保存在另一个图表之上。如果我使用 p
每当我输入数据库时,我都会使用strip_tags函数,每当我输出信息时,我都会使用htmlspecialchars。也就是说,如果我向数据库中引入类似的内容: Hello, Mr. John.
我想在我的网站上实现触摸屏自动滚动。示例可以在 Ubuntu 和 Windows 8 的界面中看到。 Ubuntu: window 8: 如果您快速向下滚动页面,松手后它会继续滚动并逐渐变慢。如果滚动
我正在尝试了解 Java 中的并发性。我知道同步,它在对象上创建一个监视器,之后另一个线程无法对该对象进行操作。 Volatile - 与处理器缓存有关,如果我使用它,所有线程都不会创建对象的副本。所
我最近将我的应用程序从使用自定义 SplashScreen(它只是一个带有计时器的表单加载主表单并自行关闭)更改为应用程序框架。 这是我所做的: 创建了一个新的 SplashScreenForm,用于
我想通过使用Sqoop作为Parquet文件将数据从Oracle导入到Hive。 我一直在尝试使用sqoop使用以下命令导入数据: sqoop import --as-parquetfile --co
我有一些使用 SpringJUnit4ClassRunner 运行的测试。我也刚刚迁移到 Log4j2,现在加载 log4j2.xml 配置文件时遇到问题,我总是收到此错误: ERROR Status
在正则表达式方面不是很好,但为什么在找到匹配项时 console.log 会触发两次? $('#name').keyup(function() { var regex = /[\€]/g;
我已经了解了 Spring Integration 4.2.0.RELEASE 中的新功能,用于通过 @EnableIntegrationManagement 注释和 捕获 channel 和处理程序
因此,我正在尝试将 vector 与智能指针一起使用,以便更轻松地进行内存管理,而且...好吧,我遇到了问题。这是我的代码的(大大缩短的)版本: bulletManager.h: class Bull
我正在制作游戏,我希望敌人绕圈移动,但敌人也应该不断向左移动。我尝试使用 CGPath 创建一个圆形路径并使其遵循该路径,然后添加一个不断向左移动的 SKAction。但节点似乎只是沿着 CGPath
我想写一个函数tokenize这需要 char s 来自迭代器。像这样: fn tokenize>(file: F) 如果我想使用 &str有了这个功能,我可以这样做: tokenize("foo".
我不确定我的理解是否正确 int i = 5; float f = 3.9; int result = i + f; 那么当int和float相加时,8.9就变成了8?这是否意味着
我想对相册进行更新突变,但在获取更新和返回值时遇到问题。 架构 Mongoose : var AlbumSchema = new Schema({ name: String, date
我是一名优秀的程序员,十分优秀!