You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
4.8 KiB
202 lines
4.8 KiB
|
|
|
|
|
|
|
|
IF OBJECT_ID('PChangeItemId') IS NOT NULL
|
|
DROP PROC PChangeItemId
|
|
GO
|
|
|
|
CREATE PROC PChangeItemId
|
|
(
|
|
@OldItemId BIGINT,
|
|
@NewItemId BIGINT
|
|
)
|
|
AS
|
|
BEGIN
|
|
SELECT * INTO #Item FROM TItem WHERE FId = @OldItemId
|
|
UPDATE #Item SET FId = @NewItemId
|
|
UPDATE TItem SET FNo = FNo + 'ÀÏ' WHERE FId = @OldItemId
|
|
EXEC PCopyTable 'TItem','#Item',''
|
|
|
|
DECLARE @sql VARCHAR(8000)
|
|
DECLARE SqlList CURSOR FOR
|
|
|
|
SELECT 'UPDATE ' + A.name + ' SET ' + B.name + ' = ' + CAST(@NewItemId AS VARCHAR)
|
|
+ ' WHERE ' + B.name + ' = ' + CAST(@OldItemId AS VARCHAR)
|
|
FROM syscolumns AS B,sysobjects AS A
|
|
WHERE( B.name LIKE '%ItemId%' OR B.name LIKE '%ContentId%')
|
|
AND A.Id = B.id
|
|
AND A.type = 'U'
|
|
AND B.name NOT IN('FMemComboItemId')
|
|
AND A.name NOT IN('TExpensesDetail','TOtherIncomeDetail','TComboDetail')
|
|
ORDER BY a.name
|
|
|
|
OPEN SQLList
|
|
FETCH SQLList INTO @sql
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
PRINT @SQL
|
|
EXEC (@SQL)
|
|
FETCH SQLList INTO @sql
|
|
END
|
|
DEALLOCATE SQLList
|
|
|
|
|
|
UPDATE TItem SET FNo = FNo + 'ÒÑɾ',FDeleted = 1 WHERE FId = @OldItemId
|
|
|
|
END
|
|
GO
|
|
|
|
|
|
|
|
IF OBJECT_ID('PChangeGoodsId') IS NOT NULL
|
|
DROP PROC PChangeGoodsId
|
|
GO
|
|
|
|
CREATE PROC PChangeGoodsId
|
|
(
|
|
@OldItemId BIGINT,
|
|
@NewItemId BIGINT
|
|
)
|
|
AS
|
|
BEGIN
|
|
SELECT * INTO #Goods FROM TGoods WHERE FId = @OldItemId
|
|
UPDATE #Goods SET FId = @NewItemId
|
|
UPDATE TGoods SET FNo = FNo + 'ÀÏ' WHERE FId = @OldItemId
|
|
EXEC PCopyTable 'TGoods','#Goods',''
|
|
|
|
DECLARE @sql VARCHAR(8000)
|
|
DECLARE SqlList CURSOR FOR
|
|
|
|
SELECT 'UPDATE ' + A.name + ' SET ' + B.name + ' = ' + CAST(@NewItemId AS VARCHAR)
|
|
+ ' WHERE ' + B.name + ' = ' + CAST(@OldItemId AS VARCHAR)
|
|
FROM syscolumns AS B,sysobjects AS A
|
|
WHERE( B.name LIKE '%GoodsId%' OR B.name LIKE '%ContentId%')
|
|
AND A.Id = B.id
|
|
AND A.type = 'U'
|
|
AND B.name NOT IN('FMemComboGoodsId')
|
|
AND A.name NOT IN('TExpensesDetail','TOtherIncomeDetail','TComboDetail')
|
|
ORDER BY a.name
|
|
|
|
OPEN SQLList
|
|
FETCH SQLList INTO @sql
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
PRINT @SQL
|
|
EXEC (@SQL)
|
|
FETCH SQLList INTO @sql
|
|
END
|
|
DEALLOCATE SQLList
|
|
|
|
|
|
UPDATE TGoods SET FNo = FNo + 'ÒÑɾ',FDeleted = 1 WHERE FId = @OldItemId
|
|
|
|
END
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
BEGIN TRAN
|
|
|
|
ROLLBACK TRAN
|
|
ROLLBACK TRAN
|
|
ROLLBACK TRAN
|
|
|
|
COMMIT TRAN
|
|
|
|
SELECT A.FNo,A.FId,A.FName,B.FNo,B.FName
|
|
FROM linyi_huaxuan..TItem AS A,LinYi_LiWa..TItem AS B
|
|
WHERE A.FId = B.FId
|
|
AND A.FName != B.FName
|
|
|
|
DECLARE @NewItemId BIGINT
|
|
SELECT @NewItemId = dbo.FNNewId()
|
|
EXEC PChangeItemId 5102761902256900426,@NewItemId
|
|
|
|
|
|
4819146111167886412
|
|
5325025576705390688
|
|
5102761902256900426
|
|
|
|
|
|
SELECT A.FNo,A.FId,A.FName,B.FNo,B.FName
|
|
FROM linyi_huaxuan..TGoods AS A,LinYi_LiWa..TGoods AS B
|
|
WHERE A.FId = B.FId
|
|
AND A.FName != B.FName
|
|
|
|
DECLARE @NewItemId BIGINT
|
|
SELECT @NewItemId = dbo.FNNewId()
|
|
EXEC PChangeGoodsId 5595501743450877905,@NewItemId
|
|
|
|
|
|
SELECT A.FNo,A.FId,A.FName,B.FNo,B.FName
|
|
FROM linyi_huaxuan..TBasicType AS A,LinYi_LiWa..TBasicType AS B
|
|
WHERE A.FId = B.FId
|
|
AND A.FName != B.FName
|
|
|
|
SELECT A.FNo,A.FId,A.FName,B.FNo,B.FName,
|
|
A.FPosId,B.FPosId,A.FDeptId,B.FDeptId,A.FIdCard,B.FIdCard,A.FState,B.FState
|
|
FROM linyi_huaxuan..TEmployee AS A,LinYi_LiWa..TEmployee AS B
|
|
WHERE A.FId = B.FId
|
|
AND (A.FName != B.FName
|
|
OR A.FIdCard != B.FIdCard
|
|
OR A.FPosId != B.FPosId
|
|
OR A.FNo != B.FNo
|
|
OR A.FState != B.FState)
|
|
|
|
SELECT * FROM linyi_liwa..TMember
|
|
WHERE FMemId IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
DELETE linyi_liwa..TMember
|
|
WHERE FMemId IN(SELECT FMemId FROM TMember)
|
|
AND FMemNO LIKE '%ÒÑɾ%'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMemId = 4820625660589768933
|
|
|
|
SELECT * FROM TConsumeBill WHERE FMemId = 4820625660589768933
|
|
|
|
SELECT 'DELETE ' + name FROM sysobjects WHERE name LIKE 'TMember%'
|
|
|
|
|
|
SELECT * FROM LinYi_LiWa..TCompany
|
|
|
|
update LinYi_LiWa..TCompany set fdeleted = 0,FNo = '012' where fid = 5125900892792299345
|
|
|
|
SELECT * FROM LinYi_LiWa..TEmployee
|
|
WHERE FId IN(
|
|
SELECT FEmpId FROM LinYi_LiWa..TEmployeeSub WHERE FCompId = 5125900892792299345
|
|
)
|
|
|
|
|
|
SELECT * FROM TConsumeItemEmployee WHERE FEmpId = 5741786952505218831
|
|
SELECT * FROM LinYi_LiWa..TConsumeItemEmployee WHERE FEmpId = 5741786952505218831
|
|
SELECT * FROM LinYi_LiWa..TConsumeGoodsEmployee WHERE FEmpId = 5741786952505218831
|
|
SELECT * FROM LinYi_LiWa..TMemberSaleEmployee WHERE FEmpId = 5741786952505218831
|
|
SELECT * FROM LinYi_LiWa..TEmployeeSub WHERE FEmpId = 5741786952505218831
|
|
SELECT * FROM LinYi_LiWa..TEmpPerfDetail# WHERE FEmpId = 5741786952505218831
|
|
|
|
DELETE LinYi_LiWa..TEmployeeSub WHERE FEmpId = 5741786952505218831
|
|
DELETE LinYi_LiWa..TEmployee WHERE FId = 5741786952505218831
|
|
|
|
SELECT * FROM TConsumeBill WHERE FBillId = 5531375135406334895
|
|
|
|
|
|
DELETE LinYi_LiWa..TEmployeeSub WHERE
|
|
|
|
|
|
SELECT * FROM TItem WHERE FId = 4819146111167886412
|
|
SELECT * FROM TItem WHERE FNo = '2017'
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|