初始库存入库相关知识
初始库存入库相关知识(kcrkd1,kcrkd2,lspcsx)
初始库存入库相关知识
业务方面:
做初始库存入库单,保存。不记账。只影响kcrkd1和kcrkd2表
入库单记账:影响lspcsx表。(做出库用)。
SELECT TOP 2 * FROM kcrkd2
SELECT TOP 2 * FROM lspcsx
SELECT * FROM aaaaa
INSERT INTO lspcsx (lspcsx_wlbh,lspcsx_pch) SELECT kcrkd2_wlbh,kcrkd2_pch FROM aaaaa
SELECT * INTO lspcsxbak19 FROM lspcsx
SELECT kcrkd2_wlbh,kcrkd2_pch INTO aaaaa FROM kcrkd2
SELECT * FROM lspcsx
UPDATE lspcsx SET lspcsx_sxrq=CONVERT(VARCHAR(50),(CONVERT(NUMERIC,lspcsx_rkrq) +20000))
,lspcsx_fjrq=CONVERT(VARCHAR(50),(CONVERT(NUMERIC,lspcsx_rkrq) +20000)) FROM lspcsx
SELECT CONVERT(VARCHAR(50),(CONVERT(NUMERIC,lspcsx_rkrq) +20000)) FROM lspcsx
UPDATE lspcsx SET lspcsx_ysph=lspcsx_pch
=CONVERT(VARCHAR(50),(LEFT(lspcsx_pch,8))) FROM lspcsx
SELECT CONVERT(VARCHAR(50),(LEFT(lspcsx_pch,8))) FROM lspcsx
---TRUNCATE TABLE lspcsx
SELECT * FROM kcrkd2 GROUP BY kcrkd2_wlbh,kcrkd2_pch HAVING COUNT(kcrkd2_wlbh)>0
select * FROM kcrkd2 WHERE kcrkd2_wlbh='101030101' AND kcrkd2_pch='20050101'
SELECT kcrkd2_wlbh,kcrkd2_pch ,COUNT(*) FROM kcrkd2 GROUP BY kcrkd2_wlbh,kcrkd2_pch HAVING COUNT(kcrkd2_wlbh)>1
SELECT *
FROM lc0079999.KCRKD2
WHERE (KCRKD2_WLBH = '101020201') AND (KCRKD2_PCH = '20071201')
SELECT * FROM lspcsx
20051111-029
select f_phonecode,f_text ,count(*) from sendsms where f_time='2007-08-22'
group by f_phonecode,f_text having count(f_phonecode)>1
-----TRUNCATE TABLE lspcsx
INSERT INTO lspcsx (lspcsx_wlbh,lspcsx_pch) SELECT kcrkd2_wlbh,kcrkd2_pch FROM aaaa
SELECT * FROM KCRKD2 WHERE KCRKD2_PCH='20070701-040'
SELECT * FROM LSPCSX WHERE lspcsx_pch IN ('20060803-035','20071201')
SELECT * FROM LSPCSX WHERE lspcsx_wlbh IN ('101010201','101040201')
SELECT * FROM kcrkd2 WHERE kcrkd2_wlbh='101020201' AND kcrkd2_flbh='0000000103'
SELECT LEFT(kcrkd2_pch,8) FROM kcrkd2 WHERE len(kcrkd2_pch)>8
SELECT * INTO kcrkd2bak FROM kcrkd2
UPDATE kcrkd2 SET kcrkd2_pch =
UPDATE kcrkd2 SET kcrkd2_pch = LEFT(kcrkd2_pch,8)+ '-' + RIGHT(kcrkd2_pch,3) WHERE len(kcrkd2_pch)>10
SELECT LEFT(kcrkd2_pch,8)+ '-' + RIGHT(kcrkd2_pch,3) FROM kcrkd2 WHERE len(kcrkd2_pch)>10
SELECT * FROM kcrkd2 WHERE kcrkd2_wlbh='101040201' AND kcrkd2_pch='20060406-041'
SELECT * FROM sysobjects WHERE name LIKE '%wlzd%' AND xtype='u'
SELECT * FROM LSWLZD WHERE lswlzd_wlbh='1010207'
SELECT * FROM kcrkd2 WHERE kcrkd2_
SELECT * FROM LSPCSX
SELECT * FROM kcrkd2 WHERE kcrkd2_wlbh='101020201' AND kcrkd2_flbh='0000000103'
SELECT LEFT(kcrkd2_pch,8) FROM kcrkd2 WHERE len(kcrkd2_pch)>8
SELECT * INTO kcrkd2bak FROM kcrkd2
UPDATE kcrkd2 SET kcrkd2_pch =
UPDATE kcrkd2 SET kcrkd2_pch = LEFT(kcrkd2_pch,8)+ '-' + RIGHT(kcrkd2_pch,3) WHERE len(kcrkd2_pch)>10
SELECT LEFT(kcrkd2_pch,8)+ '-' + RIGHT(kcrkd2_pch,3) FROM kcrkd2 WHERE len(kcrkd2_pch)>10