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.

1817 lines
35 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApproveSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2. drop procedure [dbo].[ApproveSolution]
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CheckFile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5. drop procedure [dbo].[CheckFile]
  6. GO
  7. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeleteMailEntry]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8. drop procedure [dbo].[DeleteMailEntry]
  9. GO
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeleteSpecialMail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[DeleteSpecialMail]
  12. GO
  13. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetCustomer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14. drop procedure [dbo].[GetCustomer]
  15. GO
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetEMail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17. drop procedure [dbo].[GetEMail]
  18. GO
  19. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetEventDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20. drop procedure [dbo].[GetEventDetails]
  21. GO
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetEventModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[GetEventModules]
  24. GO
  25. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetFilePath]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26. drop procedure [dbo].[GetFilePath]
  27. GO
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetHash]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  29. drop procedure [dbo].[GetHash]
  30. GO
  31. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  32. drop procedure [dbo].[GetIncident]
  33. GO
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetIncident2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[GetIncident2]
  36. GO
  37. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetIncidentInfo]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38. drop procedure [dbo].[GetIncidentInfo]
  39. GO
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetIncidentTest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  41. drop procedure [dbo].[GetIncidentTest]
  42. GO
  43. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetMailResponse]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  44. drop procedure [dbo].[GetMailResponse]
  45. GO
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetMailToList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[GetMailToList]
  48. GO
  49. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetMailToList1]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  50. drop procedure [dbo].[GetMailToList1]
  51. GO
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetModule]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  53. drop procedure [dbo].[GetModule]
  54. GO
  55. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  56. drop procedure [dbo].[GetModules]
  57. GO
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[GetProduct]
  60. GO
  61. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  62. drop procedure [dbo].[GetProducts]
  63. GO
  64. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetResourceLink]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  65. drop procedure [dbo].[GetResourceLink]
  66. GO
  67. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  68. drop procedure [dbo].[GetSolution]
  69. GO
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSolution3]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[GetSolution3]
  72. GO
  73. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSpecialMailList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  74. drop procedure [dbo].[GetSpecialMailList]
  75. GO
  76. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetStatusList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  77. drop procedure [dbo].[GetStatusList]
  78. GO
  79. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetStopCodeDesc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  80. drop procedure [dbo].[GetStopCodeDesc]
  81. GO
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetStressIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  83. drop procedure [dbo].[GetStressIncident]
  84. GO
  85. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTemplate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  86. drop procedure [dbo].[GetTemplate]
  87. GO
  88. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTransactionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  89. drop procedure [dbo].[GetTransactionID]
  90. GO
  91. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTransactionIncidents]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  92. drop procedure [dbo].[GetTransactionIncidents]
  93. GO
  94. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTransactions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  95. drop procedure [dbo].[GetTransactions]
  96. GO
  97. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[InstanceByTypeID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  98. drop procedure [dbo].[InstanceByTypeID]
  99. GO
  100. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PostFileCount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  101. drop procedure [dbo].[PostFileCount]
  102. GO
  103. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetCustomer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  104. drop procedure [dbo].[SetCustomer]
  105. GO
  106. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetDBGResults]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  107. drop procedure [dbo].[SetDBGResults]
  108. GO
  109. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetDriver]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  110. drop procedure [dbo].[SetDriver]
  111. GO
  112. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetFileCount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  113. drop procedure [dbo].[SetFileCount]
  114. GO
  115. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetFileName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  116. drop procedure [dbo].[SetFileName]
  117. GO
  118. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetFilePath]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  119. drop procedure [dbo].[SetFilePath]
  120. GO
  121. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetFilterStatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  122. drop procedure [dbo].[SetFilterStatus]
  123. GO
  124. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetHash]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  125. drop procedure [dbo].[SetHash]
  126. GO
  127. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  128. drop procedure [dbo].[SetIncident]
  129. GO
  130. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetMail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  131. drop procedure [dbo].[SetMail]
  132. GO
  133. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetMail2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  134. drop procedure [dbo].[SetMail2]
  135. GO
  136. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetMessage_stale]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  137. drop procedure [dbo].[SetMessage_stale]
  138. GO
  139. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetPassport]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  140. drop procedure [dbo].[SetPassport]
  141. GO
  142. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetResource]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  143. drop procedure [dbo].[SetResource]
  144. GO
  145. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetTrackID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  146. drop procedure [dbo].[SetTrackID]
  147. GO
  148. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetXML]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  149. drop procedure [dbo].[SetXML]
  150. GO
  151. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UpdateIncident]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  152. drop procedure [dbo].[UpdateIncident]
  153. GO
  154. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmp_GetMailToList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  155. drop procedure [dbo].[tmp_GetMailToList]
  156. GO
  157. SET QUOTED_IDENTIFIER OFF
  158. GO
  159. SET ANSI_NULLS ON
  160. GO
  161. CREATE PROCEDURE ApproveSolution(
  162. @SolutionID int,
  163. @ApprovedBy nvarchar(30),
  164. @ApprovedDate datetime
  165. ) AS
  166. UPDATE PreApprovedSolutions SET
  167. Approved = 1,
  168. ApprovedBy = @ApprovedBy,
  169. WhenApproved = @ApprovedDate
  170. WHERE SolutionID = @SolutionID
  171. GO
  172. SET QUOTED_IDENTIFIER OFF
  173. GO
  174. SET ANSI_NULLS ON
  175. GO
  176. SET QUOTED_IDENTIFIER OFF
  177. GO
  178. SET ANSI_NULLS ON
  179. GO
  180. CREATE PROCEDURE CheckFile(
  181. @IncidentID int
  182. ) AS
  183. DECLARE @Result tinyint
  184. SELECT @Result = State FROM Incident WHERE IncidentID = @IncidentID
  185. IF (@Result = 1)
  186. RETURN 0
  187. ELSE
  188. BEGIN
  189. UPDATE Incident SET State = 1 WHERE IncidentID = @IncidentID
  190. RETURN 1
  191. END
  192. GO
  193. SET QUOTED_IDENTIFIER OFF
  194. GO
  195. SET ANSI_NULLS ON
  196. GO
  197. SET QUOTED_IDENTIFIER OFF
  198. GO
  199. SET ANSI_NULLS OFF
  200. GO
  201. CREATE PROCEDURE dbo.DeleteMailEntry
  202. (
  203. @incidentid int
  204. )
  205. AS
  206. Delete from mailincidents where incidentid = @incidentid
  207. GO
  208. SET QUOTED_IDENTIFIER OFF
  209. GO
  210. SET ANSI_NULLS ON
  211. GO
  212. SET QUOTED_IDENTIFIER OFF
  213. GO
  214. SET ANSI_NULLS OFF
  215. GO
  216. CREATE PROCEDURE dbo.DeleteSpecialMail (
  217. @Sbucket int,
  218. @HighID int,
  219. @LowID int
  220. )
  221. AS
  222. Delete from mailtable where
  223. sbucket = @Sbucket and highid = @HighID and lowid = @lowID
  224. GO
  225. SET QUOTED_IDENTIFIER OFF
  226. GO
  227. SET ANSI_NULLS ON
  228. GO
  229. SET QUOTED_IDENTIFIER OFF
  230. GO
  231. SET ANSI_NULLS ON
  232. GO
  233. CREATE PROCEDURE GetCustomer (
  234. @HighID int,
  235. @LowID int
  236. ) AS
  237. SELECT * FROM Customer
  238. WHERE HighID = @HighID AND
  239. LowID = @LowID
  240. GO
  241. SET QUOTED_IDENTIFIER OFF
  242. GO
  243. SET ANSI_NULLS ON
  244. GO
  245. SET QUOTED_IDENTIFIER OFF
  246. GO
  247. SET ANSI_NULLS ON
  248. GO
  249. CREATE PROCEDURE GetEMail (
  250. @IncidentID int
  251. ) AS
  252. SELECT EMail FROM Customer INNER JOIN Incidents ON
  253. Customer.HighID = Incidents.HighID AND
  254. Customer.LowID = Incidents.LowID
  255. WHERE Incidents.IncidentID = @IncidentID
  256. GO
  257. SET QUOTED_IDENTIFIER OFF
  258. GO
  259. SET ANSI_NULLS ON
  260. GO
  261. SET QUOTED_IDENTIFIER OFF
  262. GO
  263. SET ANSI_NULLS ON
  264. GO
  265. CREATE PROCEDURE GetEventDetails (
  266. @CrashInstance int
  267. ) AS
  268. SELECT KaCrash.StopCode,
  269. KaInstance.StopCodeParameter1,
  270. KaInstance.StopCodeParameter2,
  271. KaInstance.StopCodeParameter3,
  272. KaInstance.StopCodeParameter4,
  273. KaHardware.ProcessorCount,
  274. KaHardware.ProcessorType,
  275. KaSoftware.OSBuild,
  276. KaSoftware.OSServicePackLevel,
  277. KaSoftware.QfeData,
  278. KaSoftware.OSPAEKernel,
  279. KaSoftware.OSSMPKernel,
  280. KaSoftware.OSCheckedBuild
  281. FROM KaKnownIssue2.dbo.CrashClass KaCrash
  282. INNER JOIN KaKnownIssue2.dbo.CrashInstance KaInstance ON KaCrash.ClassID = KaInstance.ClassID
  283. INNER JOIN KaKnownIssue2.dbo.HWProfile KaHardware ON KaInstance.HWProfileRecID = KaHardware.HWProfileRecID
  284. INNER JOIN KaKnownIssue2.dbo.OSProfile KaSoftware ON KaInstance.OSProfileRecID = KaSoftware.OSProfileRecID
  285. WHERE (KaInstance.InstanceID = @CrashInstance)
  286. GO
  287. SET QUOTED_IDENTIFIER OFF
  288. GO
  289. SET ANSI_NULLS ON
  290. GO
  291. SET QUOTED_IDENTIFIER OFF
  292. GO
  293. SET ANSI_NULLS ON
  294. GO
  295. CREATE PROCEDURE GetEventModules (
  296. @CrashInstance int
  297. ) AS
  298. SELECT KaModule.InstanceID,
  299. KaModuleData.BaseName,
  300. KaModuleData.SubSystemMinorVersion,
  301. KaModuleData.SubSystemMajorVersion
  302. FROM KaKnownIssue2.dbo.KernelModule KaModule
  303. INNER JOIN KaKnownIssue2.dbo.KernelModuleData KaModuleData ON KaModule.KernelModuleID = KaModuleData.KernelModuleID
  304. WHERE (KaModule.InstanceID = @CrashInstance)
  305. ORDER BY KaModuleData.BaseName
  306. GO
  307. SET QUOTED_IDENTIFIER OFF
  308. GO
  309. SET ANSI_NULLS ON
  310. GO
  311. SET QUOTED_IDENTIFIER OFF
  312. GO
  313. SET ANSI_NULLS ON
  314. GO
  315. CREATE PROCEDURE GetFilePath (
  316. @IncidentID int
  317. ) AS
  318. SELECT Path FROM Incidents WHERE IncidentID = @IncidentID
  319. GO
  320. SET QUOTED_IDENTIFIER OFF
  321. GO
  322. SET ANSI_NULLS ON
  323. GO
  324. SET QUOTED_IDENTIFIER OFF
  325. GO
  326. SET ANSI_NULLS ON
  327. GO
  328. CREATE PROCEDURE GetHash (
  329. @DumpHash nvarchar(33)
  330. ) AS
  331. SELECT IncidentID, HighID AS Customer
  332. FROM Incident
  333. WHERE DumpHash = cast(@DumpHash as binary(16))
  334. GO
  335. SET QUOTED_IDENTIFIER OFF
  336. GO
  337. SET ANSI_NULLS ON
  338. GO
  339. SET QUOTED_IDENTIFIER OFF
  340. GO
  341. SET ANSI_NULLS ON
  342. GO
  343. CREATE PROCEDURE GetIncident (
  344. @HighID int = NULL,
  345. @LowID int = NULL,
  346. @IncidentID int = NULL
  347. ) AS
  348. IF EXISTS(SELECT * FROM Incident WHERE IncidentID = @IncidentID)
  349. UPDATE Incident SET
  350. HighID = @HighID,
  351. LowID = @LowID
  352. WHERE IncidentID = @IncidentID
  353. ELSE
  354. BEGIN
  355. SET NOCOUNT ON
  356. INSERT INTO Incident
  357. (HighID, LowID, Created, Message, Filter, TrackID)
  358. VALUES
  359. (@HighID, @LowID, GETDATE(), 0, 1, '-')
  360. SELECT IncidentID = @@IDENTITY
  361. SET NOCOUNT OFF
  362. END
  363. GO
  364. SET QUOTED_IDENTIFIER OFF
  365. GO
  366. SET ANSI_NULLS ON
  367. GO
  368. SET QUOTED_IDENTIFIER OFF
  369. GO
  370. SET ANSI_NULLS ON
  371. GO
  372. CREATE PROCEDURE GetIncident2 (
  373. @HighID int = NULL,
  374. @LowID int = NULL,
  375. @TransactionID int
  376. ) AS
  377. SET NOCOUNT ON
  378. INSERT INTO Incident
  379. (HighID, LowID, Created, Message, Filter, TrackID, TransactionID)
  380. VALUES
  381. (@HighID, @LowID, GETDATE(), 0, 1, '-', @TransactionID)
  382. SELECT IncidentID = @@IDENTITY
  383. SET NOCOUNT OFF
  384. GO
  385. SET QUOTED_IDENTIFIER OFF
  386. GO
  387. SET ANSI_NULLS ON
  388. GO
  389. SET QUOTED_IDENTIFIER OFF
  390. GO
  391. SET ANSI_NULLS ON
  392. GO
  393. CREATE PROCEDURE GetIncidentInfo (
  394. @IncidentID int
  395. ) AS
  396. SELECT * FROM Incident WHERE IncidentID = @IncidentID
  397. GO
  398. SET QUOTED_IDENTIFIER OFF
  399. GO
  400. SET ANSI_NULLS ON
  401. GO
  402. SET QUOTED_IDENTIFIER OFF
  403. GO
  404. SET ANSI_NULLS OFF
  405. GO
  406. CREATE PROCEDURE GetIncidentTest (
  407. @HighID int = NULL,
  408. @LowID int = NULL,
  409. @IncidentID int = NULL
  410. ) AS
  411. IF EXISTS(SELECT HighID, LowID FROM Incident WHERE IncidentID = @IncidentID)
  412. UPDATE Incident SET
  413. HighID = @HighID,
  414. LowID = @LowID
  415. WHERE IncidentID = @IncidentID
  416. ELSE
  417. BEGIN
  418. SET NOCOUNT ON
  419. INSERT INTO Incident
  420. (HighID, LowID, Created, Message, Filter, TrackID)
  421. VALUES
  422. (@HighID, @LowID, GETDATE(), 0, 1, '-')
  423. SELECT IncidentID = @@IDENTITY
  424. SET NOCOUNT OFF
  425. END
  426. GO
  427. SET QUOTED_IDENTIFIER OFF
  428. GO
  429. SET ANSI_NULLS ON
  430. GO
  431. SET QUOTED_IDENTIFIER OFF
  432. GO
  433. SET ANSI_NULLS ON
  434. GO
  435. CREATE PROCEDURE GetMailResponse (
  436. @Type smallint,
  437. @Lang nvarchar(4)
  438. ) AS
  439. SELECT Description, Subject FROM Response WHERE
  440. Type = @Type AND
  441. Lang = @Lang
  442. GO
  443. SET QUOTED_IDENTIFIER OFF
  444. GO
  445. SET ANSI_NULLS ON
  446. GO
  447. SET QUOTED_IDENTIFIER ON
  448. GO
  449. SET ANSI_NULLS ON
  450. GO
  451. CREATE PROCEDURE GetMailToList AS
  452. SELECT top 1000 EMail,
  453. Message,
  454. Lang,
  455. TrackID AS Description,
  456. IncidentID,
  457. SendMail
  458. FROM Incident INNER JOIN Customer ON
  459. Incident.HighID = Customer.HighID AND
  460. Incident.LowID = Customer.LowID
  461. WHERE
  462. TransactionID IS NULL AND
  463. (SendMail = 1 OR SendMail = 2)
  464. UNION
  465. SELECT EMail,
  466. 16 AS Message,
  467. Lang,
  468. CAST(TransactionID AS nvarchar(8)) AS Description,
  469. TransactionID,
  470. 1 AS SendMail
  471. FROM Trans INNER JOIN Customer ON
  472. Trans.HighID = Customer.HighID AND
  473. Trans.LowID = Customer.LowID
  474. WHERE SendMail = 1 AND
  475. DATEDIFF(hh,TransDate,GETDATE()) > 23 AND
  476. EMail <> ''
  477. GO
  478. SET QUOTED_IDENTIFIER OFF
  479. GO
  480. SET ANSI_NULLS ON
  481. GO
  482. SET QUOTED_IDENTIFIER OFF
  483. GO
  484. SET ANSI_NULLS OFF
  485. GO
  486. CREATE PROCEDURE dbo.GetMailToList1 AS
  487. select top 2000 c.EMail, c.Lang, i.trackid as Description, m.IncidentID
  488. from mailincidents as m
  489. inner join incident as i on m.incidentid = i.incidentid
  490. inner join customer as c on i.highid = c.highid and i.lowid = c.lowid
  491. where i.TransactionID is null
  492. GO
  493. SET QUOTED_IDENTIFIER OFF
  494. GO
  495. SET ANSI_NULLS ON
  496. GO
  497. SET QUOTED_IDENTIFIER OFF
  498. GO
  499. SET ANSI_NULLS ON
  500. GO
  501. CREATE PROCEDURE GetModule (
  502. @ModuleID int
  503. ) AS
  504. SELECT ModuleName FROM Modules WHERE ModuleID = @ModuleID
  505. GO
  506. SET QUOTED_IDENTIFIER OFF
  507. GO
  508. SET ANSI_NULLS ON
  509. GO
  510. SET QUOTED_IDENTIFIER OFF
  511. GO
  512. SET ANSI_NULLS ON
  513. GO
  514. CREATE PROCEDURE GetModules
  515. AS
  516. SELECT ModuleID, ModuleName FROM Modules ORDER BY ModuleID
  517. GO
  518. SET QUOTED_IDENTIFIER OFF
  519. GO
  520. SET ANSI_NULLS ON
  521. GO
  522. SET QUOTED_IDENTIFIER OFF
  523. GO
  524. SET ANSI_NULLS ON
  525. GO
  526. CREATE PROCEDURE GetProduct (
  527. @ProductID int
  528. ) AS
  529. SELECT ProductName FROM Products WHERE ProductID = @ProductID
  530. GO
  531. SET QUOTED_IDENTIFIER OFF
  532. GO
  533. SET ANSI_NULLS ON
  534. GO
  535. SET QUOTED_IDENTIFIER OFF
  536. GO
  537. SET ANSI_NULLS ON
  538. GO
  539. CREATE PROCEDURE GetProducts
  540. AS
  541. SELECT ProductID, ProductName FROM Products ORDER BY ProductName
  542. GO
  543. SET QUOTED_IDENTIFIER OFF
  544. GO
  545. SET ANSI_NULLS ON
  546. GO
  547. SET QUOTED_IDENTIFIER OFF
  548. GO
  549. SET ANSI_NULLS ON
  550. GO
  551. CREATE PROCEDURE GetResourceLink (
  552. @Lang nvarchar(4)
  553. ) AS
  554. SELECT Category, LinkTitle, URL FROM Resources
  555. WHERE Lang = @Lang
  556. GROUP BY Category, LinkTitle, URL
  557. GO
  558. SET QUOTED_IDENTIFIER OFF
  559. GO
  560. SET ANSI_NULLS ON
  561. GO
  562. SET QUOTED_IDENTIFIER OFF
  563. GO
  564. SET ANSI_NULLS ON
  565. GO
  566. CREATE PROCEDURE GetSolution(
  567. @ClassID nvarchar(256),
  568. @Lang nvarchar(4)
  569. ) AS
  570. SELECT SolutionType, SP, TemplateID, ProductID, Description, ContactID, ModuleID
  571. FROM KaKnownIssue2.dbo.SolutionEx KaSolution INNER JOIN KaKnownIssue2.dbo.CrashClass KaCrash ON
  572. KaSolution.SolutionID = KaCrash.SolutionID
  573. WHERE ClassID = @ClassID AND Lang = @Lang AND KaSolution.SolutionID <> 1
  574. GO
  575. SET QUOTED_IDENTIFIER OFF
  576. GO
  577. SET ANSI_NULLS ON
  578. GO
  579. SET QUOTED_IDENTIFIER OFF
  580. GO
  581. SET ANSI_NULLS ON
  582. GO
  583. CREATE PROCEDURE GetSolution3(
  584. @SolutionID int,
  585. @Lang nvarchar(4)
  586. ) AS
  587. SELECT SolutionType, SP, TemplateID, ProductID, Description, ContactID, ModuleID
  588. FROM KaKnownIssue2.dbo.SolutionEx KaSolution
  589. WHERE SolutionID = @SolutionID AND Lang = @Lang
  590. GO
  591. SET QUOTED_IDENTIFIER OFF
  592. GO
  593. SET ANSI_NULLS ON
  594. GO
  595. SET QUOTED_IDENTIFIER OFF
  596. GO
  597. SET ANSI_NULLS OFF
  598. GO
  599. CREATE PROCEDURE dbo.GetSpecialMailList AS
  600. Select top 1000 Sbucket as Type, HighID, LowID, Email, Lang from
  601. MailTable
  602. GO
  603. SET QUOTED_IDENTIFIER OFF
  604. GO
  605. SET ANSI_NULLS ON
  606. GO
  607. SET QUOTED_IDENTIFIER OFF
  608. GO
  609. SET ANSI_NULLS ON
  610. GO
  611. CREATE PROCEDURE GetStatusList (
  612. @HighID int,
  613. @LowID int
  614. ) AS
  615. --SELECT IncidentID,gBucket,Created,ComputerName,Description,sBucket,Filter,Message,Display, TrackID
  616. --FROM Incident WHERE HighID = @HighID AND LowID = @LowID AND TransactionID IS NULL AND
  617. --TrackID <> '-' ORDER BY Created DESC
  618. SELECT i.IncidentID,i.gBucket, i.sBucket, ss.BucketType as sBucketType, gs.BucketType as gBucketType, ss.Bucket as sbsBucket, gs.Bucket as sbgBucket, h.iStopCode, i.Created, i.ComputerName,
  619. i.Description,i.Filter,i.Message,i.Display,i.TrackID--
  620. FROM Incident as i
  621. Left join Solutions.dbo.SolvedBuckets as ss
  622. on i.sBucket = ss.Bucket
  623. Left join Solutions.dbo.SolvedBuckets as gs
  624. on i.gBucket = gs.Bucket
  625. Left join Solutions.dbo.HelpInfo as h
  626. on i.StopCode = h.iStopCode
  627. WHERE i.HighID = @HighID AND i.LowID = @LowID AND i.TransactionID IS NULL AND i.TrackID <> '-'
  628. ORDER BY Created DESC
  629. GO
  630. SET QUOTED_IDENTIFIER OFF
  631. GO
  632. SET ANSI_NULLS ON
  633. GO
  634. SET QUOTED_IDENTIFIER OFF
  635. GO
  636. SET ANSI_NULLS ON
  637. GO
  638. CREATE PROCEDURE GetStopCodeDesc(
  639. @StopCode varchar(8)
  640. ) AS
  641. SELECT Name FROM KaKnownIssue2.dbo.StopCodeDescription WHERE StopCode = @StopCode
  642. GO
  643. SET QUOTED_IDENTIFIER OFF
  644. GO
  645. SET ANSI_NULLS ON
  646. GO
  647. SET QUOTED_IDENTIFIER OFF
  648. GO
  649. SET ANSI_NULLS OFF
  650. GO
  651. CREATE PROCEDURE dbo.GetStressIncident(
  652. @HighID int = NULL,
  653. @LowID int = NULL,
  654. @IncidentID int = NULL
  655. ) AS
  656. BEGIN
  657. INSERT INTO Incident
  658. (HighID, LowID, Created, Message, Filter, TrackID)
  659. VALUES
  660. (@HighID, @LowID, GETDATE(), 0, 1, '-')
  661. select Incidentid = @@Identity
  662. END
  663. GO
  664. SET QUOTED_IDENTIFIER OFF
  665. GO
  666. SET ANSI_NULLS ON
  667. GO
  668. SET QUOTED_IDENTIFIER OFF
  669. GO
  670. SET ANSI_NULLS ON
  671. GO
  672. CREATE PROCEDURE GetTemplate (
  673. @TemplateID int
  674. ) AS
  675. SELECT TemplateName, Description FROM Templates WHERE TemplateID = @TemplateID
  676. GO
  677. SET QUOTED_IDENTIFIER OFF
  678. GO
  679. SET ANSI_NULLS ON
  680. GO
  681. SET QUOTED_IDENTIFIER OFF
  682. GO
  683. SET ANSI_NULLS ON
  684. GO
  685. CREATE PROCEDURE GetTransactionID (
  686. @HighID int,
  687. @LowID int,
  688. @Description nvarchar(64),
  689. @Type tinyint
  690. ) AS
  691. SET NOCOUNT ON
  692. INSERT INTO Trans
  693. (HighID, LowID, SendMail, Status, Description, Type, TransDate)
  694. VALUES
  695. (@HighID, @LowID, 1, 0, @Description, @Type, GETDATE())
  696. SET NOCOUNT OFF
  697. SELECT TransactionID = @@IDENTITY
  698. GO
  699. SET QUOTED_IDENTIFIER OFF
  700. GO
  701. SET ANSI_NULLS ON
  702. GO
  703. SET QUOTED_IDENTIFIER OFF
  704. GO
  705. SET ANSI_NULLS ON
  706. GO
  707. CREATE PROCEDURE GetTransactionIncidents (
  708. @TransID int
  709. ) AS
  710. --SELECT
  711. --KaCust.ClassID, KaCust.Display, KaCrash.StopCode, KaCust.Message, KaCust.IncidentID, KaCust.TrackID, KaCust.InstanceID
  712. --FROM Incident KaCust LEFT JOIN KaKnownIssue2.dbo.CrashClass KaCrash
  713. --ON KaCust.ClassID = KaCrash.ClassID
  714. --WHERE TransactionID = @TransID
  715. --ORDER BY KaCust.ClassID, KaCust.Message desc
  716. Select i.sBucket, ss.Bucket as ssBucket, ss.BucketType as sBucketType, i.gBucket, gs.Bucket as gsBucket, gs.BucketType as gBucketType,
  717. h.iStopCode, i.Display, i.Message, i.IncidentID, i.TrackID
  718. from Incident as i
  719. left join Solutions.dbo.SolvedBuckets as ss
  720. on i.sBucket = ss.Bucket
  721. left join Solutions.dbo.SolvedBuckets as gs
  722. on i.gBucket = gs.Bucket
  723. left join Solutions.dbo.HelpInfo as h
  724. on i.StopCode = h.iStopCode
  725. where i.TransactionID = @TransID
  726. Order By i.sBucket, i.Message
  727. GO
  728. SET QUOTED_IDENTIFIER OFF
  729. GO
  730. SET ANSI_NULLS ON
  731. GO
  732. SET QUOTED_IDENTIFIER ON
  733. GO
  734. SET ANSI_NULLS ON
  735. GO
  736. CREATE PROCEDURE GetTransactions (
  737. @HighID int,
  738. @LowID int
  739. ) AS
  740. SELECT TransactionID, Status, TransDate, Description, Type, FileCount
  741. FROM Trans
  742. WHERE HighID = @HighID AND
  743. LowID = @LowID AND
  744. FileCount IS NOT NULL
  745. ORDER BY TransDate DESC
  746. GO
  747. SET QUOTED_IDENTIFIER OFF
  748. GO
  749. SET ANSI_NULLS ON
  750. GO
  751. SET QUOTED_IDENTIFIER OFF
  752. GO
  753. SET ANSI_NULLS ON
  754. GO
  755. CREATE PROCEDURE InstanceByTypeID (
  756. @TransID int
  757. ) AS
  758. SELECT COUNT(sBucket) AS ClassidTotal, sBucket FROM Incident
  759. WHERE TransactionID = @TransID
  760. GROUP BY sBucket
  761. GO
  762. SET QUOTED_IDENTIFIER OFF
  763. GO
  764. SET ANSI_NULLS ON
  765. GO
  766. SET QUOTED_IDENTIFIER OFF
  767. GO
  768. SET ANSI_NULLS ON
  769. GO
  770. CREATE PROCEDURE PostFileCount (
  771. @TransactionID int,
  772. @FileCount int
  773. ) AS
  774. UPDATE Trans SET
  775. FileCount = @FileCount
  776. WHERE
  777. TransactionID = @TransactionID
  778. GO
  779. SET QUOTED_IDENTIFIER OFF
  780. GO
  781. SET ANSI_NULLS ON
  782. GO
  783. SET QUOTED_IDENTIFIER OFF
  784. GO
  785. SET ANSI_NULLS ON
  786. GO
  787. CREATE PROCEDURE SetCustomer (
  788. @HighID int,
  789. @LowID int,
  790. @EMail nvarchar(128) = NULL,
  791. @Contact nvarchar(32) = NULL,
  792. @Phone nvarchar(16) = NULL,
  793. @PremierID nvarchar(16) = NULL,
  794. @Lang nvarchar(4) = 'USA'
  795. ) AS
  796. IF EXISTS (SELECT * FROM Customer WHERE HighID = @HighID AND LowID = @LowID)
  797. BEGIN
  798. IF (@PremierID IS NULL)
  799. UPDATE Customer SET
  800. EMail = @EMail,
  801. Phone = @Phone,
  802. Contact = @Contact,
  803. Lang = @Lang
  804. WHERE
  805. HighID = @HighID AND
  806. LowID = @LowID
  807. ELSE
  808. UPDATE Customer SET
  809. EMail = @EMail,
  810. Phone = @Phone,
  811. Contact = @Contact,
  812. Lang = @Lang,
  813. PremierID = @PremierID
  814. WHERE
  815. HighID = @HighID AND
  816. LowID = @LowID
  817. END
  818. ELSE
  819. INSERT INTO Customer
  820. (HighID, LowID, EMail, Phone, Contact, Lang, PremierID)
  821. VALUES
  822. (@HighID, @LowID, @EMail, @Phone, @Contact, @Lang, @PremierID)
  823. GO
  824. SET QUOTED_IDENTIFIER OFF
  825. GO
  826. SET ANSI_NULLS ON
  827. GO
  828. SET QUOTED_IDENTIFIER OFF
  829. GO
  830. SET ANSI_NULLS OFF
  831. GO
  832. CREATE PROCEDURE [dbo].[SetDBGResults]
  833. @ip_IncidentID as int,
  834. @ip_gBucket as int,
  835. @ip_GenericBucket as nvarchar(100),
  836. @ip_sBucket as int,
  837. @ip_SpecificBucket as nvarchar(100),
  838. @ip_StopCode as int,
  839. @ip_SendMail as int
  840. AS
  841. SET NOCOUNT ON
  842. IF @ip_SendMail <> 0
  843. -- do updations in Incident table
  844. UPDATE Incident SET StopCode = @ip_StopCode, sBucket = @ip_sBucket, gBucket = @ip_gBucket, Message = 2, SendMail = @ip_SendMail WHERE incidentid = @ip_IncidentID
  845. IF @ip_SendMail = 1
  846. BEGIN
  847. /*
  848. DECLARE @i_HighLowIDFlag bit, @i_TrackIDFlag bit, @i_TransactionIDFlag bit, @i_IncidentIDFlag bit, @i_MailIncidentsFlag bit
  849. SET @i_HighLowIDFlag = 0
  850. SET @i_TrackIDFlag = 0
  851. SET @i_TransactionIDFlag = 0
  852. SET @i_IncidentIDFlag = 0
  853. SET @i_MailIncidentsFlag = 0
  854. DECLARE @i_LoopCount int
  855. SET @i_LoopCount = 40
  856. WHILE @i_LoopCount > 5
  857. BEGIN
  858. IF (@i_MailIncidentsFlag = 0)
  859. AND ((SELECT IncidentID FROM MailIncidents WHERE IncidentID = @ip_IncidentID) IS NOT NULL )
  860. SET @i_MailIncidentsFlag = 1
  861. IF (@i_MailIncidentsFlag = 1)
  862. BREAK
  863. IF (@i_IncidentIDFlag = 0) AND
  864. ((SELECT IncidentID FROM Incident WHERE IncidentID = @ip_IncidentID) IS NOT NULL )
  865. SET @i_IncidentIDFlag = 1
  866. IF (@i_HighLowIDFlag = 0) AND
  867. ((SELECT IncidentID FROM Incident WHERE IncidentID = @ip_IncidentID AND HighID IS NOT NULL AND LowID IS NOT NULL) IS NOT NULL )
  868. SET @i_HighLowIDFlag = 1
  869. IF (@i_TrackIDFlag = 0) AND
  870. ((SELECT IncidentID FROM Incident WHERE IncidentID = @ip_IncidentID AND Trackid <> '-' AND TrackID IS NOT NULL) IS NOT NULL )
  871. SET @i_TrackIDFlag = 1
  872. IF (@i_TransactionIDFlag = 0)
  873. AND ((SELECT IncidentID FROM Incident WHERE IncidentID = @ip_IncidentID AND Transactionid IS NULL) IS NOT NULL )
  874. SET @i_TransactionIDFlag = 1
  875. IF (@i_IncidentIDFlag = 1) AND (@i_HighLowIDFlag = 1) AND (@i_TrackIDFlag = 1) AND (@i_TransactionIDFlag = 1) AND
  876. ((SELECT IncidentID FROM MailIncidents WHERE IncidentID = @ip_IncidentID) IS NULL)
  877. INSERT MailIncidents VALUES (@ip_IncidentID, 1)
  878. SET @i_LoopCount = @i_LoopCount - 1
  879. END
  880. DECLARE @i_InstanceID int
  881. SET @i_InstanceID = (-10000 * @i_MailIncidentsFlag) + (-1000 * @i_IncidentIDFlag) + (-100 * @i_HighLowIDFlag) + (-10 * @i_TrackIDFlag) + (-1 * @i_TransactionIDFlag)
  882. UPDATE Incident SET ClassID = @i_LoopCount, InstanceID = @i_InstanceID WHERE IncidentID = @ip_IncidentID
  883. IF @@ERROR <> 0
  884. BEGIN
  885. SELECT 0
  886. SET NOCOUNT OFF
  887. RETURN
  888. END
  889. */
  890. IF ((SELECT IncidentID FROM MailIncidents WHERE IncidentID = @ip_IncidentID) IS NULL)
  891. INSERT MailIncidents VALUES (@ip_IncidentID, 1)
  892. IF @@ERROR <> 0
  893. BEGIN
  894. SELECT 0
  895. SET NOCOUNT OFF
  896. RETURN
  897. END
  898. END
  899. SELECT 1
  900. SET NOCOUNT OFF
  901. GO
  902. SET QUOTED_IDENTIFIER OFF
  903. GO
  904. SET ANSI_NULLS ON
  905. GO
  906. SET QUOTED_IDENTIFIER OFF
  907. GO
  908. SET ANSI_NULLS ON
  909. GO
  910. CREATE PROCEDURE SetDriver (
  911. @IncidentID int,
  912. @Filename nvarchar(16),
  913. @CreateDate datetime,
  914. @Version nvarchar(16),
  915. @FileSize int,
  916. @Manufacturer nvarchar(32),
  917. @ProductName nvarchar(128)
  918. ) AS
  919. DECLARE @DriverID int
  920. IF EXISTS(SELECT DriverID FROM Drivers WHERE Filename = @Filename AND Version = @Version)
  921. SELECT @DriverID = DriverID FROM Drivers WHERE Filename = @Filename AND Version = @Version
  922. ELSE
  923. BEGIN
  924. INSERT INTO Drivers
  925. (Filename, CreateDate, Version, FileSize, Manufacturer, ProductName)
  926. VALUES
  927. (@Filename, @CreateDate, @Version, @FileSize, @Manufacturer, @ProductName)
  928. SELECT @DriverID = @@IDENTITY
  929. END
  930. INSERT INTO DriverList
  931. (DriverID, IncidentID)
  932. VALUES
  933. (@DriverID, @IncidentID)
  934. GO
  935. SET QUOTED_IDENTIFIER OFF
  936. GO
  937. SET ANSI_NULLS ON
  938. GO
  939. SET QUOTED_IDENTIFIER OFF
  940. GO
  941. SET ANSI_NULLS ON
  942. GO
  943. CREATE PROCEDURE SetFileCount (
  944. @TransactionID int,
  945. @FileCount int
  946. ) AS
  947. UPDATE Trans SET
  948. FileCount = @FileCount
  949. WHERE
  950. TransactionID = @TransactionID
  951. GO
  952. SET QUOTED_IDENTIFIER OFF
  953. GO
  954. SET ANSI_NULLS ON
  955. GO
  956. SET QUOTED_IDENTIFIER OFF
  957. GO
  958. SET ANSI_NULLS ON
  959. GO
  960. CREATE PROCEDURE SetFileName (
  961. @IncidentID int,
  962. @Display nvarchar(256)
  963. ) AS
  964. UPDATE Incident SET
  965. Display = @Display
  966. WHERE
  967. IncidentID = @IncidentID
  968. GO
  969. SET QUOTED_IDENTIFIER OFF
  970. GO
  971. SET ANSI_NULLS ON
  972. GO
  973. SET QUOTED_IDENTIFIER OFF
  974. GO
  975. SET ANSI_NULLS ON
  976. GO
  977. CREATE PROCEDURE SetFilePath (
  978. @IncidentID int,
  979. @Path nvarchar(256)
  980. ) AS
  981. UPDATE Incident SET
  982. Path = @Path
  983. WHERE
  984. IncidentID = @IncidentID
  985. GO
  986. SET QUOTED_IDENTIFIER OFF
  987. GO
  988. SET ANSI_NULLS ON
  989. GO
  990. SET QUOTED_IDENTIFIER OFF
  991. GO
  992. SET ANSI_NULLS ON
  993. GO
  994. CREATE PROCEDURE SetFilterStatus (
  995. @FilterType char(1),
  996. @Incidents varchar(3250)
  997. ) AS
  998. EXEC('UPDATE Incident SET Filter = ' + @FilterType + ' WHERE IncidentID IN (' + @Incidents + ')')
  999. GO
  1000. SET QUOTED_IDENTIFIER OFF
  1001. GO
  1002. SET ANSI_NULLS ON
  1003. GO
  1004. SET QUOTED_IDENTIFIER OFF
  1005. GO
  1006. SET ANSI_NULLS ON
  1007. GO
  1008. CREATE PROCEDURE SetHash (
  1009. @IncidentID int,
  1010. @DumpHash nvarchar(33)
  1011. ) AS
  1012. UPDATE Incident SET
  1013. DumpHash = cast(@DumpHash as binary(16))
  1014. WHERE
  1015. IncidentID = @IncidentID
  1016. GO
  1017. SET QUOTED_IDENTIFIER OFF
  1018. GO
  1019. SET ANSI_NULLS ON
  1020. GO
  1021. SET QUOTED_IDENTIFIER OFF
  1022. GO
  1023. SET ANSI_NULLS ON
  1024. GO
  1025. CREATE PROCEDURE SetIncident (
  1026. @IncidentID int,
  1027. @OSVersion nvarchar(16) = NULL,
  1028. @Description nvarchar(512) = NULL,
  1029. @Display nvarchar(256) = NULL,
  1030. @Repro nvarchar(1024) = NULL,
  1031. @Comments nvarchar(1024) = NULL,
  1032. @TrackID nvarchar(16) = NULL
  1033. ) AS
  1034. DECLARE @OSName nvarchar(32)
  1035. SET @OSName = 'Not Selected'
  1036. IF (@OSVersion = '1')
  1037. SET @OSName = 'Windows 2000 Professional'
  1038. IF (@OSVersion = '2')
  1039. SET @OSName = 'Windows 2000 Server'
  1040. IF (@OSVersion = '3')
  1041. SET @OSName = 'Windows 2000 Advanced Server'
  1042. IF (@OSVersion = '4')
  1043. SET @OSName = 'Windows 2000 Datacenter Server'
  1044. IF (@OSVersion = '5')
  1045. SET @OSName = 'Windows XP Personal'
  1046. IF (@OSVersion = '6')
  1047. SET @OSName = 'Windows XP Professional'
  1048. IF (@OSVersion = '7')
  1049. SET @OSName = 'Windows XP Server'
  1050. IF (@OSVersion = '8')
  1051. SET @OSName = 'Windows XP Advanced Server'
  1052. IF (@OSVersion = '9')
  1053. SET @OSName = 'Windows XP Datacenter Server'
  1054. IF (@OSVersion = '10')
  1055. SET @OSName = 'Windows XP 64-bit edition'
  1056. IF EXISTS (SELECT * FROM Incident WHERE IncidentID = @IncidentID)
  1057. IF @OSVersion is NULL
  1058. Begin
  1059. UPDATE Incident SET
  1060. Description = @Description,
  1061. Display = @Display,
  1062. Repro = @Repro,
  1063. Comments = @Comments,
  1064. TrackID = @TrackID
  1065. WHERE
  1066. IncidentID = @IncidentID
  1067. End
  1068. else
  1069. begin
  1070. UPDATE Incident SET
  1071. OSName = @OSName,
  1072. Description = @Description,
  1073. Display = @Display,
  1074. Repro = @Repro,
  1075. Comments = @Comments,
  1076. TrackID = @TrackID
  1077. WHERE
  1078. IncidentID = @IncidentID
  1079. end
  1080. ELSE
  1081. INSERT INTO Incident
  1082. (Created, OSVersion, Description, Display, Repro, Comments, Filter, TrackID)
  1083. VALUES
  1084. (GETDATE(), @OSVersion, @Description, @Display, @Repro, @Comments, 1, @TrackID)
  1085. GO
  1086. SET QUOTED_IDENTIFIER OFF
  1087. GO
  1088. SET ANSI_NULLS ON
  1089. GO
  1090. SET QUOTED_IDENTIFIER OFF
  1091. GO
  1092. SET ANSI_NULLS ON
  1093. GO
  1094. CREATE PROCEDURE SetMail (
  1095. @IncidentID int
  1096. ) AS
  1097. UPDATE Incident SET
  1098. SendMail = 0
  1099. WHERE
  1100. IncidentID = @IncidentID
  1101. GO
  1102. SET QUOTED_IDENTIFIER OFF
  1103. GO
  1104. SET ANSI_NULLS ON
  1105. GO
  1106. SET QUOTED_IDENTIFIER OFF
  1107. GO
  1108. SET ANSI_NULLS ON
  1109. GO
  1110. CREATE PROCEDURE SetMail2 (
  1111. @TransactionID int
  1112. ) AS
  1113. UPDATE Trans SET
  1114. SendMail = 0
  1115. WHERE
  1116. TransactionID = @TransactionID
  1117. GO
  1118. SET QUOTED_IDENTIFIER OFF
  1119. GO
  1120. SET ANSI_NULLS ON
  1121. GO
  1122. SET QUOTED_IDENTIFIER OFF
  1123. GO
  1124. SET ANSI_NULLS ON
  1125. GO
  1126. CREATE PROCEDURE SetMessage (
  1127. @IncidentID int,
  1128. @Message smallint,
  1129. @SendMail smallint
  1130. ) AS
  1131. IF (@Message = 3)
  1132. BEGIN
  1133. UPDATE Incident SET
  1134. Message = @Message,
  1135. SendMail = @SendMail,
  1136. DumpHash = NULL
  1137. WHERE
  1138. IncidentID = @IncidentID
  1139. END
  1140. ELSE
  1141. BEGIN
  1142. UPDATE Incident SET
  1143. Message = @Message,
  1144. SendMail = @SendMail
  1145. WHERE
  1146. IncidentID = @IncidentID
  1147. END
  1148. GO
  1149. SET QUOTED_IDENTIFIER OFF
  1150. GO
  1151. SET ANSI_NULLS ON
  1152. GO
  1153. SET QUOTED_IDENTIFIER OFF
  1154. GO
  1155. SET ANSI_NULLS ON
  1156. GO
  1157. CREATE PROCEDURE SetPassport (
  1158. @HighID int,
  1159. @LowID int,
  1160. @IncidentID int
  1161. ) AS
  1162. UPDATE Incident SET
  1163. HighID = @HighID,
  1164. LowID = @LowID
  1165. WHERE
  1166. IncidentID = @IncidentID
  1167. GO
  1168. SET QUOTED_IDENTIFIER OFF
  1169. GO
  1170. SET ANSI_NULLS ON
  1171. GO
  1172. SET QUOTED_IDENTIFIER OFF
  1173. GO
  1174. SET ANSI_NULLS ON
  1175. GO
  1176. CREATE PROCEDURE SetResource (
  1177. @ID int,
  1178. @Lang nvarchar(4),
  1179. @Category nvarchar(64),
  1180. @URL nvarchar(128),
  1181. @LinkTitle nvarchar(128)
  1182. ) AS
  1183. IF EXISTS(SELECT * FROM Resources WHERE ID = @ID AND Lang = @Lang)
  1184. UPDATE Resources SET
  1185. Category = @Category,
  1186. URL = @URL,
  1187. LinkTitle = @LinkTitle
  1188. WHERE ID = @ID AND
  1189. Lang = @Lang
  1190. ELSE
  1191. INSERT INTO Resources
  1192. (Lang, Category, URL, LinkTitle)
  1193. VALUES
  1194. (@Lang, @Category, @URL, @LinkTitle)
  1195. GO
  1196. SET QUOTED_IDENTIFIER OFF
  1197. GO
  1198. SET ANSI_NULLS ON
  1199. GO
  1200. SET QUOTED_IDENTIFIER OFF
  1201. GO
  1202. SET ANSI_NULLS ON
  1203. GO
  1204. CREATE PROCEDURE SetTrackID (
  1205. @IncidentID int,
  1206. @TrackID nvarchar(16)
  1207. ) AS
  1208. UPDATE Incident SET
  1209. TrackID = @TrackID
  1210. WHERE
  1211. IncidentID = @IncidentID
  1212. GO
  1213. SET QUOTED_IDENTIFIER OFF
  1214. GO
  1215. SET ANSI_NULLS ON
  1216. GO
  1217. SET QUOTED_IDENTIFIER OFF
  1218. GO
  1219. SET ANSI_NULLS ON
  1220. GO
  1221. CREATE PROCEDURE SetXML (
  1222. @IncidentID int,
  1223. @ComputerName nvarchar(32),
  1224. @OSName nvarchar(64),
  1225. @OSVersion nvarchar(32),
  1226. @OSLang nvarchar(4)
  1227. ) AS
  1228. UPDATE Incident SET
  1229. ComputerName = @ComputerName,
  1230. OSName = @OSName,
  1231. OSVersion = @OSVersion,
  1232. OSLang = @OSLang
  1233. WHERE
  1234. IncidentID = @IncidentID
  1235. GO
  1236. SET QUOTED_IDENTIFIER OFF
  1237. GO
  1238. SET ANSI_NULLS ON
  1239. GO
  1240. SET QUOTED_IDENTIFIER OFF
  1241. GO
  1242. SET ANSI_NULLS ON
  1243. GO
  1244. CREATE PROCEDURE UpdateIncident (
  1245. @IncidentID int,
  1246. @Repro nvarchar(1024) = NULL,
  1247. @Comments nvarchar(1024) = NULL
  1248. ) AS
  1249. UPDATE Incident SET
  1250. Repro = @Repro,
  1251. Comments = @Comments
  1252. WHERE
  1253. IncidentID = @IncidentID
  1254. GO
  1255. SET QUOTED_IDENTIFIER OFF
  1256. GO
  1257. SET ANSI_NULLS ON
  1258. GO
  1259. SET QUOTED_IDENTIFIER ON
  1260. GO
  1261. SET ANSI_NULLS ON
  1262. GO
  1263. CREATE PROCEDURE tmp_GetMailToList AS
  1264. SELECT EMail,
  1265. Message,
  1266. Lang,
  1267. TrackID AS Description,
  1268. I.IncidentID,
  1269. I.SendMail
  1270. FROM Incident AS I INNER JOIN Customer AS C ON
  1271. I.HighID = C.HighID AND
  1272. I.LowID = C.LowID AND
  1273. I.IncidentID IN (SELECT IncidentID FROM MailIncidents) --ORDER BY IncidentID ASC)
  1274. WHERE TrackID <> '-' AND
  1275. TransactionID IS NULL AND
  1276. TrackID IS NOT NULL
  1277. -- AND (I.SendMail = 1 OR I.SendMail = 2)
  1278. UNION
  1279. SELECT EMail,
  1280. 16 AS Message,
  1281. Lang,
  1282. CAST(TransactionID AS nvarchar(8)) AS Description,
  1283. TransactionID,
  1284. 1 AS SendMail
  1285. FROM Trans INNER JOIN Customer ON
  1286. Trans.HighID = Customer.HighID AND
  1287. Trans.LowID = Customer.LowID
  1288. WHERE SendMail = 1 AND
  1289. DATEDIFF(hh,TransDate,GETDATE()) > 23 AND
  1290. EMail <> ''
  1291. GO
  1292. SET QUOTED_IDENTIFIER OFF
  1293. GO
  1294. SET ANSI_NULLS ON
  1295. GO