Guest User

Untitled

a guest
Jul 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. CREATE TABLE [dbo].[My_Transactions](
  2. [My_TransactionId] [bigint] NOT NULL,
  3. [FileId] [int] NOT NULL,
  4. [RowNo] [int] NOT NULL,
  5. [TransactionTypeId] [smallint] NOT NULL,
  6. [TransactionDate] [datetime] NOT NULL,
  7. [TransactionNumber] [dbo].[TransactionNumber] NOT NULL,
  8. [CardNumber] [dbo].[CardNumber] NULL,
  9. [AccountNumber] [dbo].[CardNumber] NULL,
  10. [BankCardTypeId] [smallint] NOT NULL,
  11. [AcqBankId] [smallint] NOT NULL,
  12. [DeviceNumber] [dbo].[DeviceNumber] NOT NULL,
  13. [Amount] [dbo].[Amount] NOT NULL,
  14. [DeviceTypeId] [smallint] NOT NULL,
  15. [TransactionFee] [dbo].[Amount] NOT NULL,
  16. [AcqSwitchId] [tinyint] NOT NULL
  17. ) ON [PRIMARY]
  18.  
  19. GO
  20.  
  21. CREATE NONCLUSTERED INDEX [_dta_index_Jam_Transactions_8_1290487676__K1_K4_K12_K6_K11_5] ON [dbo].[Jam_Transactions]
  22. (
  23. [Jam_TransactionId] ASC,
  24. [TransactionTypeId] ASC,
  25. [Amount] ASC,
  26. [TransactionNumber] ASC,
  27. [DeviceNumber] ASC
  28. )
  29. INCLUDE ( [TransactionDate]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  30. GO
  31.  
  32. CREATE NONCLUSTERED INDEX [_dta_index_Jam_Transactions_8_1290487676__K12_K6_K11_K1_5] ON [dbo].[Jam_Transactions]
  33. (
  34. [Amount] ASC,
  35. [TransactionNumber] ASC,
  36. [DeviceNumber] ASC,
  37. [Jam_TransactionId] ASC
  38. )
  39. INCLUDE ( [TransactionDate]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  40. GO
  41.  
  42. CREATE NONCLUSTERED INDEX [IX_Jam_Transactions] ON [dbo].[Jam_Transactions]
  43. (
  44. [Jam_TransactionId] ASC
  45. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  46. GO
  47.  
  48. UPDATE STATISTICS my_table
  49.  
  50. A, B, D, E, F
  51.  
  52. A, B, D, E, F, C
  53.  
  54. A, B, D, _, E, F
  55.  
  56. SELECT *
  57. FROM your_table_name WITH (INDEX(your_index_name))
  58. WHERE your_column_name = 5
Add Comment
Please, Sign In to add comment