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
public int UpdateQty(string strPartID, int iQty, int iUpdateQty, string strBarCode, string strCreaterId) { int iRet; SqlConnection conn = DBConnection.GetConn_SPAIS(); SqlCommand cmd = new SqlCommand("CSP0203_UpdateQty", conn); cmd.CommandType =
SQL Server 2008中SQL应用系列--目录索引 今天在做一个案例演示时,在SQL Server 2012中使用Insert语句插入1万条数据,结果遇到了一个奇怪的现象,现将过程分享出来,以供有兴趣的同学参考. 附:我的测试环境为:SQL Server 2012,命名实例 Microsoft SQL Server 2012 - 11.0.2100.60 (Intel X86) Feb 10 2012 19:13:17 Copyright (c) Microsoft Corporatio
在SQL SERVER中获取表中的第二条数据, 思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据 sql语句如下: select top 1 * from(select top 2 * from NumberLog where UserName = '管理员' order by dateTime desc ) [table] order by dateTime asc
当要往有设置自增标识字段的表插入数据,并希望同时设置好自增字段的值时,可以在insert into 的SQL语句前后分别加上一句sql语句,SET IDENTITY_INSERT TableName ON和SET IDENTITY_INSERT TableName OFF //tb_Users 的id字段是种子为1的自增标识字段 SET IDENTITY_INSERT tb_Users ON if not exists(select * from tb_Users where id = 1) b