Leaked source code of windows server 2003
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.

52 lines
1.1 KiB

  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE PROC sp_AddToDrBin (
  6. @i_CIDNAME VARCHAR(20),
  7. @i_BinName VARCHAR(100),
  8. @i_BinStamp INT
  9. ) AS
  10. BEGIN
  11. DECLARE @t_CID BIGINT
  12. DECLARE @t_CIDName VARCHAR(20)
  13. DECLARE @t_BinID BIGINT
  14. DECLARE @t_BinName VARCHAR(100)
  15. -- Insert record into table DriversUsed
  16. IF NOT EXISTS
  17. (SELECT CIDName FROM DriverUsed WHERE CIDName = @i_CIDName)
  18. BEGIN
  19. INSERT dbo.DriverUsed(CIDName) VALUES (@i_CIDName)
  20. END
  21. -- Insert record into table DrNames
  22. IF NOT EXISTS
  23. (SELECT BinName FROM dbo.DrNames WHERE BinName = LOWER(@i_BinName))
  24. BEGIN
  25. INSERT dbo.DrNames(BinName) VALUES (LOWER(@i_BinName))
  26. END
  27. --
  28. SELECT @t_BinID=BinID FROM dbo.DrNames WHERE BinName = LOWER(@i_BinName)
  29. SELECT @t_CID=CID FROM dbo.DriverUsed WHERE CIDName = @i_CIDName
  30. -- Insert record into
  31. IF NOT EXISTS
  32. (SELECT CID FROM dbo.DrBins WHERE CID = @t_CID AND BinID = @t_BinID AND BinStamp = @i_BinStamp)
  33. BEGIN
  34. INSERT dbo.DrBins VALUES(@t_CID, @i_BinStamp, @t_BinID)
  35. END
  36. END
  37. GO
  38. SET QUOTED_IDENTIFIER OFF
  39. GO
  40. SET ANSI_NULLS ON
  41. GO