CreateEvents.bat 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. @echo off
  2. if "%1" == "" goto usage
  3. if "%1" == "/?" goto usage
  4. if "%1" == "-?" goto usage
  5. set rcfeddb=Federation
  6. set rcfeddbsrv=
  7. set rcfeddbpw=/P
  8. set sqlfile="%temp%\Events.sql"
  9. rem check for specified database
  10. if /i "%1"=="/d" set rcfeddb=%2%
  11. if /i "%2"=="/d" set rcfeddb=%3%
  12. if /i "%3"=="/d" set rcfeddb=%4%
  13. if /i "%4"=="/d" set rcfeddb=%5%
  14. if /i "%5"=="/d" set rcfeddb=%6%
  15. if /i "%6"=="/d" set rcfeddb=%7%
  16. if /i "%7"=="/d" set rcfeddb=%8%
  17. rem check for specified server
  18. if /i "%1"=="/s" set rcfeddbsrv=/S %2%
  19. if /i "%2"=="/s" set rcfeddbsrv=/S %3%
  20. if /i "%3"=="/s" set rcfeddbsrv=/S %4%
  21. if /i "%4"=="/s" set rcfeddbsrv=/S %5%
  22. if /i "%5"=="/s" set rcfeddbsrv=/S %6%
  23. if /i "%6"=="/s" set rcfeddbsrv=/S %7%
  24. if /i "%7"=="/s" set rcfeddbsrv=/S %8%
  25. rem check for specified password
  26. if /i "%1"=="/p" set rcfeddbpw=/P %2%
  27. if /i "%2"=="/p" set rcfeddbpw=/P %3%
  28. if /i "%3"=="/p" set rcfeddbpw=/P %4%
  29. if /i "%4"=="/p" set rcfeddbpw=/P %5%
  30. if /i "%5"=="/p" set rcfeddbpw=/P %6%
  31. if /i "%6"=="/p" set rcfeddbpw=/P %7%
  32. if /i "%7"=="/p" set rcfeddbpw=/P %8%
  33. rem in sql7, bcp doesn't like /P when the password is blank, but osql does--go figure
  34. set rcfedbcppw=%rcfeddbpw%
  35. if /i "%rcfeddbpw%"=="/P" set rcfedbcppw=
  36. echo USE %rcfeddb% > %sqlfile%
  37. echo go >> %sqlfile%
  38. :recreate
  39. copy /b %sqlfile%+Events.sql %sqlfile%
  40. osql /U sa /n %rcfeddbsrv% %rcfeddbpw% /i %sqlfile%
  41. goto end
  42. :usage
  43. rem ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
  44. echo Description: Creates the AGC Events Table/schema in an existing database.
  45. echo.
  46. echo Usage: CreateEvents [/S Server] [/P Password] [/D Database] [/L]
  47. echo.
  48. echo Where: Server is machine of database in which you want to create the table.
  49. echo Password is the password for the sa account
  50. echo Database is the name of the SQL database in which to create the table
  51. echo /L causes the log to be preserved. Default is to dump the log prior to
  52. echo nuking and recreating the database.
  53. echo.
  54. echo Notes: * You must leave a space between all switches and their values
  55. echo * All parameters in brackets are optional, and may appear in any order
  56. echo * Password only matters if server doesn't use trusted connections
  57. echo * The created table is ALWAYS named Events
  58. echo.
  59. echo Example: CreateEvents /S ZONEAGGA01 /D Allegiance
  60. echo.
  61. rem ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
  62. :end
  63. set rcfeddb=
  64. set rcfeddbsrv=
  65. set rcfeddbpw=
  66. set rcfeddbdumplog=
  67. set rcfedbcppw=
  68. set sqlfile=