RyuujinZero

Untitled

Mar 11th, 2021
996
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USE Games
  2.  
  3. DECLARE @GameID AS INT
  4. DECLARE @Date AS DATE
  5. DECLARE @LicenseKey AS VARCHAR(255)
  6. DECLARE @Game AS VARCHAR(255)
  7. DECLARE @Platform AS VARCHAR(50)
  8.  
  9. SET @LicenseKey = 'ABCDE-FGHIJ-KLMNO'
  10. SET @Game = 'Gee 2: Gee Two Gee'
  11. SET @Platform = 'Steam'
  12.  
  13. IF NOT EXISTS
  14. (
  15.     SELECT GameName
  16.     FROM Games
  17.     WHERE GameName = @Game
  18. )
  19.     BEGIN
  20.         INSERT INTO Games (GameName)
  21.         VALUES (@Game);
  22.         END;
  23.        
  24. SET @GameID = (
  25.     SELECT GameID
  26. FROM Games
  27. WHERE GameName = @Game
  28. );
  29.  
  30. SET @Date = (
  31.     SELECT GETDATE()
  32.     );
  33.  
  34. INSERT INTO LicenseKeys (GameID, DateAcquired, LicenseKey,Used,Platform)
  35. VALUES
  36. (@GameID,@Date,@LicenseKey,'No',@Platform);
RAW Paste Data