以下是我代码的一部分BEGIN
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted
where icstockbillentry i join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInteridEND报错:
服务器: 消息 170,级别 15,状态 1,过程 t_BOSWJRKEntry_DEL,行 49
第 49 行: 'i' 附近有语法错误。
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted
where icstockbillentry i join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInteridEND报错:
服务器: 消息 170,级别 15,状态 1,过程 t_BOSWJRKEntry_DEL,行 49
第 49 行: 'i' 附近有语法错误。
解决方案 »
- 一个小问题想自己解决,能力有限,问问各位,给个建议
- Excel数据导入到SQL SERVER中数据丢失的问题
- 请教SQL SERVER关于还原模式先简单还是完全的疑问
- 帮注释解释一下,这个示例(来自MSDN);
- 如何将两个表的两个字段的记录作为建立另外一个表的字段和记录???
- 请问对时间建立索引到底对查询性能有沒有提高呢?我沒有试出来过。
- 函数和存储过程各自的优缺点,分别什么时候用?
- 插入数据库一个字符串,查一下最新录入的100条内是否有重复的
- 急问题!n张表的连接怎么写?小弟的关系数据库能力实在太差,谢谢支持!
- 求救!!!定给高分!!!(在线等待!!!!!)
- 关于SQLServer RML 工具的问题
- 模版表定义触发器?
insert into ICStockbillEntry (FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted i -- Notice here
where icstockbillentry
join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInterid
insert into ICStockbillEntry (FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted i
-- where icstockbillentry --and this line
join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInterid
[/code]
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from icstockbillentry i join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInterid
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted
where icstockbillentry i -- 这里是要将inserted表和icstockbillentry表做join? 根据什么join?
join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInteridEND
BEGIN
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted i
inner join icstockbill i1 on i.finterid = i1.finteridn
where i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInterid
END
我是越做越糊涂,概念都糊涂了。
问题:
对于插入的每一行来说,SQL会创建该新行的副本并把它插入到一个特殊表中,称为INSERTED
我是这样理解的,比如说有表a
(列名)名字
(数据)张三
现在插入一行
(数据)李四
请问INSERTED的内容是什么? 我理解INSERTED此时的内容是
名字
张三
李四
on table
for insert
as
begin
update db_product set a.h_isbn=b.h_isbn from db_prodct a join inserted b on a.h_id=b.h_id
end----------------------这种写法语法上说错吴的
BEGIN
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted
where icstockbillentry i -- 这里是要将inserted表和icstockbillentry表做join? 根据什么join?
join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInterid END
--这样?
BEGIN
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted a, icstockbillentry i, icstockbill i1 where i.finterid = i1.finterid and i.FEntryID=a.ROWS and i1.FTranType =1 and i.FSourceInterid=a.FInteridEND
名字
李四
insert into ICStockbillEntry(FItemID,FUnitID,Fauxqty,Faxuprice,Famount,FDCStockID)
select FMaterialCode,FUnit,FFactAccQty,FPrice,FAmount,FWarehouse
from inserted
where icstockbillentry i inner join icstockbill i1 on i.finterid = i1.finterid and i.FEntryID=@ROWS and i1.FTranType =1 and i.FSourceInterid=@FInteridEND少了 inner或者 left ,究竟用哪个看你自己的了.
using namespace std;
class Shape
{public:
virtual double area() const=0;
};
class Circle:public Shape
{public:
Circle(double r):radius(r){ }
virtual double area() const{return 3.14159*radius;};
protected:
double radius;
};
class Square:public Shape
{public:
Square(double s):side(s){ }
virtual double area() const{return side*side;
protected:
double side;
};
class Rectangle:public Shape
{public:
Rectangle(double w,double h):width(w),height(h){ }
virtual double area( ) const {return width*height;}
protected:
double width,height;
};
class Trapezoid:public Shape
{public:
Trapezoid(double t,double b,double h):top(t),bottom(t),height(h){ }
virtual double area( )const{return 0.5*(top+bottom)*height;}
protected:
double top,bottom,height;
};
class Triangle:public Shape
{public:
Triangle(double w,double h):width(w),height(h){}
virtual double area() const{retarn 0.5*width*height;}
protected:
double width,height;
};
int main()
{
Circle circle(12.6);
Square square(3.5);
Rectangle rectangle(4.5,8.4);
Trapezoid trapezoid(2.0,4.5,3.2);
Triangle triangle(4.5,8.4);
Shape *pt[5]={&cricle,&square,&rectangle,&trapezoid,&triangle};
double area=0.0;
for(int i=0;i<5;i++)
{areas=areas+pt[i]->area();}
cout<<"total of all areas="<<areas<<endl;
return 0;
}