日期:2014-05-17 浏览次数:20471 次
create proc sp_tmpCashPurchaseDetailUpdate as UPDATE CPD SET CPD.ItemID = TMPCPD.ItemID FROM CashPurchaseDetail AS CPD INNER JOIN ##tmpCashPurchaseDetail AS TMPCPD ON CPD.CashPurchaseNo = TMPCPD.CashPurchaseNo AND CPD.LineID = TMPCPD.LineID AND TMPCPD.VerifyIUD = 0 go
create proc sp_tmpCashPurchaseDetailUpdate as UPDATE CPD SET CPD.ItemID = TMPCPD.ItemID FROM CashPurchaseDetail AS CPD INNER JOIN ##tmpCashPurchaseDetail AS TMPCPD ON CPD.CashPurchaseNo = TMPCPD.CashPurchaseNo AND CPD.LineID = TMPCPD.LineID AND TMPCPD.VerifyIUD = 0 Cross Join CPD go
ALTER PROCEDURE [dbo].[SP_User_Hierarchy_Expend2_Dr2] (@current nvarchar(50)) AS BEGIN SET NOCOUNT ON DECLARE @lvl int, @line nvarchar(50), @parent nvarchar(50) CREATE TABLE #stack (item nvarchar(50), lvl int) CREATE TABLE #stack2 (item nvarchar(50), parent nvarchar(50), lvl int) INSERT INTO #stack VALUES (@current, 1) SELECT @lvl = 1 WHILE @lvl > 0 BEGIN IF EXISTS (SELECT * FROM #stack WHERE lvl = @lvl) BEGIN SELECT @current = item FROM #stack WHERE lvl = @lvl SELECT @line = @current SELECT @parent = Parent FROM SP_User_Hierarchy WHERE Child=@current insert #stack2 values(@current, @parent, @lvl) DELETE FROM #stack WHERE lvl = @lvl AND item = @current INSERT #stack SELECT Child, @lvl + 1 FROM SP_User_Hierarchy WHERE Parent = @current IF @@ROWCOUNT > 0 SELECT @lvl = @lvl + 1 END ELSE SELECT @lvl = @lvl - 1 END -- WHILE Begin SELECT lvl, aspnet_Users.UserName as UserName, aspnet_Membership.IsApproved, aspnet_Membership.IsLockedOut, SP_User_Manager.ManagerType, SP_User_Manager.County, SP_User_Manager.Zip, SP_User_Manager.State, SP_User_Manager.LastName + ', ' + SP_User_Manager.FirstName AS FullName FROM aspnet_Users INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId INNER JOIN SP_User_Manager ON aspnet_Users.UserName = SP_User_Manager.UserName INNER JOIN #stack2 on item = SP_User_Manager.UserName END END