11,850
社区成员
发帖
与我相关
我的任务
分享
以下在数据库db1中进行查询
DELETE FROM [缺货目录]
INSERT INTO [缺货目录](订单号,编号,产品名字,型号,数量)
select d.订单号,c.编号,c.产品名字,c.型号,b.数量
from 发货表 A,订货表 B,仓库表 C,存货表 d
where A.列A1=1 and A.ID=B.列B1 and B.列B1=1 and B.列B2=C.列C1 and d.列D1=a.列A2
order by d.订单号
以下在数据库db2中进行查询
SELECT DISTINCT b.[销售订单],b.[工程名],b.[工程管理人],b.[工程经理]
FROM db1.dbo缺货目录 a,db2.dbo.汇报 c,db2.dbo.合同行 b
where c.列C1=a.列A1 AND c.列C1=b.列B1
ALTER proc SendMail
@Mail tvpMail readonly
as
begin
declare @SNIndex bigint
declare @AllocCount int
select @AllocCount=Count(1) from @Mail
exec[dbo].AllocSerials @AllocCount = @AllocCount,@StartSN = @SNIndex output
insert into FSMail(
ID,CreatedOn,ModifiedOn,Priority,[Status],
CreatedBy,ModifiedBy
,[Subject]
,MailTo,cc,BCC
,Body
,MailFrom
,MailToUserID,Remark
,[WorkflowID] ,[StateID],[InstanceID] ,[StateID] ,[EntityID],[EntityFullName]
,[SendAttachment]
,SysVersion
)
select ID=@SNIndex-1+ROW_NUMBER() over(order by ID)
,CreatedOn=getdate(),ModifiedOn=getdate(),Priority=1,[Status]=0
,CreatedBy=CreatedBy,ModifiedBy='admin'
,[Subject]
,MailTo,cc,BCC
,Body
,MailFrom
,MailToUserID
,Remark
,[WorkflowID] ,[StateID],[InstanceID] ,[StateID] ,[EntityID],[EntityFullName]
,[SendAttachment]
,SysVersion=0
from @Mail
end