Advertisement
Guest User

Untitled

a guest
Mar 9th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.70 KB | None | 0 0
  1. /*
  2. Opretter den storage procedure der vil blive brugt
  3. til at oprette et scorekort. Det er ikke meningen at
  4. denne skal ekskveseres af en bruger, men bliver ekskveseres
  5. af en anden storage procedure.
  6. */
  7. CREATE PROCEDURE sp_opretScorekort
  8. @medlemNo       SMALLINT
  9. AS
  10. INSERT INTO SCOREKORT
  11. (dato,medlemNo)
  12. VALUES (GETDATE(),@medlemNo)
  13. GO
  14.  
  15. /*
  16. Opretter den storage procedure der vil blive brugt
  17. til at indtaste de forskellige runder på et scorekort.
  18. Det er ikke meningen at denne skal ekskveseres af en
  19. bruger, men bliver ekskveseres af en anden storage procedure.
  20. */
  21. CREATE PROCEDURE sp_opretRunde
  22. @rundeNo        TINYINT,
  23. @resul1         TINYINT,
  24. @resul2         TINYINT,
  25. @resul3         TINYINT,
  26. @resul4         TINYINT,
  27. @resul5         TINYINT
  28. AS
  29. INSERT INTO RUNDE
  30. (rundeNo,scoreNo,resul1,resul2,resul3,resul4,resul5)
  31. VALUES (@rundeNo,(SELECT TOP 1 scoreNo FROM SCOREKORT ORDER BY scoreNo DESC),@resul1,@resul2,@resul3,@resul4,@resul5)
  32. GO
  33.  
  34. /*
  35. Opretter den storage procedure som vil blive
  36. brugt til at indtaste resultater
  37. */
  38. CREATE PROCEDURE sp_indtastResultat
  39. @medlemNo           SMALLINT,
  40. @resul1_1           TINYINT = 0,
  41. @resul1_2           TINYINT = 0,
  42. @resul1_3           TINYINT = 0,
  43. @resul1_4           TINYINT = 0,
  44. @resul1_5           TINYINT = 0,
  45. @resul2_1           TINYINT = 0,
  46. @resul2_2           TINYINT = 0,
  47. @resul2_3           TINYINT = 0,
  48. @resul2_4           TINYINT = 0,
  49. @resul2_5           TINYINT = 0,
  50. @resul3_1           TINYINT = 0,
  51. @resul3_2           TINYINT = 0,
  52. @resul3_3           TINYINT = 0,
  53. @resul3_4           TINYINT = 0,
  54. @resul3_5           TINYINT = 0,
  55. @resul4_1           TINYINT = 0,
  56. @resul4_2           TINYINT = 0,
  57. @resul4_3           TINYINT = 0,
  58. @resul4_4           TINYINT = 0,
  59. @resul4_5           TINYINT = 0,
  60. @resul5_1           TINYINT = 0,
  61. @resul5_2           TINYINT = 0,
  62. @resul5_3           TINYINT = 0,
  63. @resul5_4           TINYINT = 0,
  64. @resul5_5           TINYINT = 0,
  65. @resul6_1           TINYINT = 0,
  66. @resul6_2           TINYINT = 0,
  67. @resul6_3           TINYINT = 0,
  68. @resul6_4           TINYINT = 0,
  69. @resul6_5           TINYINT = 0,
  70. @resul7_1           TINYINT = 0,
  71. @resul7_2           TINYINT = 0,
  72. @resul7_3           TINYINT = 0,
  73. @resul7_4           TINYINT = 0,
  74. @resul7_5           TINYINT = 0,
  75. @resul8_1           TINYINT = 0,
  76. @resul8_2           TINYINT = 0,
  77. @resul8_3           TINYINT = 0,
  78. @resul8_4           TINYINT = 0,
  79. @resul8_5           TINYINT = 0
  80. AS
  81. EXECUTE sp_opretScorekort @medlemNo;
  82. EXECUTE sp_opretRunde 1,@resul1_1,@resul1_2,@resul1_3,@resul1_4,resul1_5;
  83. EXECUTE sp_opretRunde 2,@resul2_1,@resul2_2,@resul2_3,@resul2_4,resul2_5;
  84. EXECUTE sp_opretRunde 3,@resul3_1,@resul3_2,@resul3_3,@resul3_4,resul3_5;
  85. EXECUTE sp_opretRunde 4,@resul4_1,@resul4_2,@resul4_3,@resul4_4,resul4_5;
  86. EXECUTE sp_opretRunde 5,@resul5_1,@resul5_2,@resul5_3,@resul5_4,resul5_5;
  87. EXECUTE sp_opretRunde 6,@resul6_1,@resul6_2,@resul6_3,@resul6_4,resul6_5;
  88. EXECUTE sp_opretRunde 7,@resul7_1,@resul7_2,@resul7_3,@resul7_4,resul7_5;
  89. EXECUTE sp_opretRunde 8,@resul8_1,@resul8_2,@resul8_3,@resul8_4,resul8_5;
  90. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement