select bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'我想将mf_bom中数据写到临时表#tf_bom中并同时建立字段xsprice,默认值0,数字型,保留4位小数.请帮忙.谢谢!
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'我想将mf_bom中数据写到临时表#tf_bom中并同时建立字段xsprice,默认值0,数字型,保留4位小数.请帮忙.谢谢!
into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'
into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'
Create Table #mf_bom
(
bom_no int,
prd_no int,
name varchar(10),
spc int default 0,
Xsprice numeric(10,4) default 0,
Clcost numeric(10,4) default 0,
Tgcost numeric(10,4) default 0)
go
--md,刚才打好了结果CSDN挂了,不知道你们有没挂
select bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost,
convert(decimal(18,4),0) as xsprice
into #mf_bom
from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'
bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost, 0.0000 as xsprice
into
#mf_bom from mf_bom
where
prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'
if object_id('tempdb..#mf_bom') is not null drop table #mf_bom
select bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost,
convert(decimal(18,4),0) as xsprice,convert(decimal(18,4),0) as Clcost,
convert(decimal(18,4),0) as tgcost
into #mf_bom
from mf_bom
where prd_no='10000110044A040P8032D00'
测试不能通过
select bom_no,prd_no,name,spc,
0.0000 as xsprice,0.0000 as Clcost,0.0000 as tgcost
into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'i see,是上面的意思
非常感谢你们
另外怎么给分啊
错误:
消息 2705,级别 16,状态 3,第 3 行
各表中的列名必须唯一。在表 '#mf_bom' 中多次指定了列名 'xsprice'。
select bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'alter table #mf_bom add xsprice decimal(18,4) default(0.0000)
错误:消息 2705,级别 16,状态 4,第 2 行
各表中的列名必须唯一。在表 '#mf_bom' 中多次指定了列名 'xsprice'。
convert(decimal(18,4),0) as Xsprice,
convert(decimal(18,4),0) as Clcost,
convert(decimal(18,4),0) as Tgcost,
into #mf_bom
from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00
drop table #mf_bom
select bom_no,prd_no,name,spc,0 as Xsprice,0 as Clcost,0 as Tgcost into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'alter table #mf_bom add xsprice decimal(18,4) default(0.0000)
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'alter table #mf_bom add xsprice decimal(18,4) default(0.0000)
select bom_no,prd_no,name,spc,convert(numeric(28, 8),0) as Xsprice,
convert(numeric(28, 8),0) as Clcost,convert(numeric(28, 8),0) as tgcost
into #mf_bom from mf_bom
where prd_no='10000110044A040P8032D00' or prd_no='60170201001B064P8051A00'谢谢大家