用于从另一个表插入常量加值的存储过程 [英] Stored procedure for inserting a constant plus values from another table

查看:27
本文介绍了用于从另一个表插入常量加值的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们想在插入的记录中Col3包含一个常量字符串'Foo',如何修改下面的存储过程?

How to modify the following stored procedure if we want in the inserted records the Col3 contain a constant string 'Foo'?

INSERT Table2
       (Col1,
       Col2,
       Col3)
SELECT T1Col1,
       T1Col2
FROM   Table1

推荐答案

INSERT Table2
       (Col1,
       Col2,
       Col3)
SELECT T1Col1,
       T1Col2,
       'Something'
FROM   Table1

这篇关于用于从另一个表插入常量加值的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆