如何从子查询中将数据插入到其他表中? [英] how to insert data into other table from subquery..?
本文介绍了如何从子查询中将数据插入到其他表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一些数据插入其他表但面临错误..
i want to insert some data into other table but facing error..
insert into tbl_bank_mst
select CONVERT(varchar,'100'+ROW_NUMBER() over(order by t.a)) h,t.a,t.b,t.c,0,GETDATE(),null,'admin' from
(
select distinct c_branch_name a,LEFT(c_branch_name,4) b,c_branch_name c from Tbl_Emp_Mst
where c_branch_name is not null and c_branch_name<>''
)t
错误是这样的..请告诉我快,因为它非常紧急
Msg 8152,Level 16,State 14,Line 1
字符串或二进制数据将被截断。
语句已终止。
error is like this ..pls tell me fast since it is very urgent
Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.
推荐答案
您好,
当字段不足以容纳要在表中插入的数据时,会出现此类错误。首先检查表结构,然后插入。
Hello ,
This type of error comes when The field is NOT big enough to hold the data that you want to insert in table . First check the table structure and then insert .
这篇关于如何从子查询中将数据插入到其他表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文