1:创建触发器,A表新增记录时B表也相应添加一条记录
CREATE TRIGGER task_insert
ON [A]
FOR INSERT
AS
insert into B(OrgAddr,DestAddr,SM_Content,SendTime,SubTime,ServiceID)
select OrgAddr,DestAddr,SM_Content,SendTime,SubTime,ServiceID from Inserted
go
2:左连接
select a.mobile,b.name
from tbl_senduser a left join tbl_employee b
on( b.mobile=a.mobile) where a.sjb_id=8
3:时间模糊查找
select * from tbl_gz where convert(varchar,edittime,120) like '%2010%'