select
'JHB-22-090309-01' as no,
id=identity(int 1,1)
into #
from 作业
where 选择='Y' insert into 计划(单号,ID) select * from #drop table #
'JHB-22-090309-01' as no,
id=identity(int 1,1)
into #
from 作业
where 选择='Y' insert into 计划(单号,ID) select * from #drop table #
解决方案 »
- exec xp_cmdshell 'bcp my_db.dbo.t out c:\test.dat -c -U sa -P ' 报错!
- 表数据删除问题
- 动态SQL基本使用求解
- Microsoft OLE DB Provider for SQL Server 错误 '80004005'
- SqlServer获取百分比
- 邹建大哥,怎么写这样的触发器?
- 按条件排序的问题
- 一个值得关注的实际问题!请每一个朋友都进来看看!
- 数据库中的二进制记录如何读取为word文件?
- 如何得知某个数据库表已被另外一个事务加锁?
- 小梁等高手救急:B/S结构多系统(网站,论坛,其它业务系统)数据库设计(及具体实现)
- 如何检验出在表A中插入一条数据后,表A的触发器给表B同时插入了一条数据?
select m.* , id = (select count(1) from
(
select 'JHB-22-090309-01' 单号 from 作业 where 选择='Y'
) n where 单号 < m.单号
) + 1 from
(
select 'JHB-22-090309-01' 单号 from 作业 where 选择='Y'
) m--insert
insert into 计划(单号,ID)
select m.* , id = (select count(1) from
(
select 'JHB-22-090309-01' 单号 from 作业 where 选择='Y'
) n where 单号 < m.单号
) + 1 from
(
select 'JHB-22-090309-01' 单号 from 作业 where 选择='Y'
) m