begin --通过销货单与明细,生成安装项目及明细,及判断明细是否拆分生成多条 --delete from sazxm --delete from ssbazrw --获取未生成项目的销货单号 ,),a.id xmid into #sazxmlist from sales a where a.id not in (select id from sazxm) and ),a.ddjrq,) ),) --根据销货单 单据日期 生成 当天安装项目,公司安装的直接到待安装状态 insert into…
--创建.删除临时表 --第一种方式 create table #tmp(name varchar(255),id int) --第二种方式 select count(id) as storyNum , sum(convert(numeric(10,2),case when isnumeric(code)=1 then code else 0 end)) as codeNum, sum((case when isnumeric(realcode)=1 then convert(numeric(1…
sql server 中临时表与数据表的区别 1.如何判断临时表和数据表已生成 --如何判断临时表是否已创建--- if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Temp_Student')) begin print '存在临时表'; end else begin print '不存在临时表'; end --如何判断数据表是否已创建--- if exists(select * from sys.ta…
转自 <SQL Server 创建索引的 5 种方法> 地址:https://www.cnblogs.com/JiangLe/p/4007091.html 前期准备: create table Employee ( ID int not null primary key, Name nvarchar(4), Credit_Card_ID varbinary(max)); --- 小心这种数据类型. go 说…