Advertisement
Guest User

Untitled

a guest
May 24th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 9.66 KB | None | 0 0
  1. SET ANSI_NULLS ON
  2. GO
  3. SET QUOTED_IDENTIFIER ON
  4. GO
  5. CREATE TABLE [dbo].[ItemLanguages](
  6.     [ItemID] [INT] NOT NULL,
  7.     [LanguageID] [INT] NOT NULL,
  8.     [Name] [nvarchar](50) NULL,
  9.     [Color] [nvarchar](50) NULL
  10. ) ON [PRIMARY]
  11.  
  12. GO
  13. SET ANSI_NULLS ON
  14. GO
  15. SET QUOTED_IDENTIFIER ON
  16. GO
  17. SET ANSI_PADDING ON
  18. GO
  19. CREATE TABLE [dbo].[Items](
  20.     [ID] [INT] IDENTITY(1,1) NOT NULL,
  21.     [code] [VARCHAR](50) NULL,
  22.  CONSTRAINT [PK_Items] PRIMARY KEY CLUSTERED
  23. (
  24.     [ID] ASC
  25. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  26. ) ON [PRIMARY]
  27.  
  28. GO
  29. SET ANSI_PADDING OFF
  30. GO
  31. SET ANSI_NULLS ON
  32. GO
  33. SET QUOTED_IDENTIFIER ON
  34. GO
  35. SET ANSI_PADDING ON
  36. GO
  37. CREATE TABLE [dbo].[Languages](
  38.     [ID] [INT] IDENTITY(1,1) NOT NULL,
  39.     [LANGUAGE] [VARCHAR](50) NULL,
  40.  CONSTRAINT [PK_Languages] PRIMARY KEY CLUSTERED
  41. (
  42.     [ID] ASC
  43. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  44. ) ON [PRIMARY]
  45.  
  46. GO
  47. SET ANSI_PADDING OFF
  48. GO
  49. SET ANSI_NULLS ON
  50. GO
  51. SET QUOTED_IDENTIFIER ON
  52. GO
  53. CREATE VIEW [dbo].[view1]
  54. AS
  55. SELECT     dbo.Items.ID AS ItemID, dbo.Languages.ID AS LanguageID
  56. FROM         dbo.Items CROSS JOIN
  57.                       dbo.Languages
  58.  
  59. GO
  60. SET ANSI_NULLS ON
  61. GO
  62. SET QUOTED_IDENTIFIER ON
  63. GO
  64. CREATE VIEW [dbo].[resultsView]
  65. AS
  66. SELECT     dbo.view1.ItemID, dbo.view1.LanguageID, dbo.ItemLanguages.Name, dbo.ItemLanguages.Color
  67. FROM         dbo.ItemLanguages RIGHT OUTER JOIN
  68.                       dbo.view1 ON dbo.ItemLanguages.LanguageID = dbo.view1.LanguageID AND dbo.ItemLanguages.ItemID = dbo.view1.ItemID
  69.  
  70. GO
  71. INSERT [dbo].[ItemLanguages] ([ItemID], [LanguageID], [Name], [Color]) VALUES (1, 1, N'Apple', N'Red')
  72. GO
  73. INSERT [dbo].[ItemLanguages] ([ItemID], [LanguageID], [Name], [Color]) VALUES (1, 2, N'Pomme', N'Rouge')
  74. GO
  75. INSERT [dbo].[ItemLanguages] ([ItemID], [LanguageID], [Name], [Color]) VALUES (2, 1, N'Orange', NULL)
  76. GO
  77. INSERT [dbo].[ItemLanguages] ([ItemID], [LanguageID], [Name], [Color]) VALUES (3, 1, N'Bannana', N'yellow')
  78. GO
  79. SET IDENTITY_INSERT [dbo].[Items] ON
  80.  
  81. GO
  82. INSERT [dbo].[Items] ([ID], [code]) VALUES (1, N'item1')
  83. GO
  84. INSERT [dbo].[Items] ([ID], [code]) VALUES (2, N'item2')
  85. GO
  86. INSERT [dbo].[Items] ([ID], [code]) VALUES (3, N'item3')
  87. GO
  88. INSERT [dbo].[Items] ([ID], [code]) VALUES (4, N'item4')
  89. GO
  90. SET IDENTITY_INSERT [dbo].[Items] OFF
  91. GO
  92. SET IDENTITY_INSERT [dbo].[Languages] ON
  93.  
  94. GO
  95. INSERT [dbo].[Languages] ([ID], [LANGUAGE]) VALUES (1, N'English')
  96. GO
  97. INSERT [dbo].[Languages] ([ID], [LANGUAGE]) VALUES (2, N'French')
  98. GO
  99. INSERT [dbo].[Languages] ([ID], [LANGUAGE]) VALUES (3, N'German')
  100. GO
  101. SET IDENTITY_INSERT [dbo].[Languages] OFF
  102. GO
  103. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @VALUE=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
  104. Begin DesignProperties =
  105.   Begin PaneConfigurations =
  106.      Begin PaneConfiguration = 0
  107.         NumPanes = 4
  108.         Configuration = "(H (1[32] 4[24] 2[7] 3) )"
  109.      End
  110.      Begin PaneConfiguration = 1
  111.         NumPanes = 3
  112.         Configuration = "(H (1 [50] 4 [25] 3))"
  113.      End
  114.      Begin PaneConfiguration = 2
  115.         NumPanes = 3
  116.         Configuration = "(H (1 [50] 2 [25] 3))"
  117.      End
  118.      Begin PaneConfiguration = 3
  119.         NumPanes = 3
  120.         Configuration = "(H (4 [30] 2 [40] 3))"
  121.      End
  122.      Begin PaneConfiguration = 4
  123.         NumPanes = 2
  124.         Configuration = "(H (1 [56] 3))"
  125.      End
  126.      Begin PaneConfiguration = 5
  127.         NumPanes = 2
  128.         Configuration = "(H (2 [66] 3))"
  129.      End
  130.      Begin PaneConfiguration = 6
  131.         NumPanes = 2
  132.         Configuration = "(H (4 [50] 3))"
  133.      End
  134.      Begin PaneConfiguration = 7
  135.         NumPanes = 1
  136.         Configuration = "(V (3))"
  137.      End
  138.      Begin PaneConfiguration = 8
  139.         NumPanes = 3
  140.         Configuration = "(H (1[56] 4[18] 2) )"
  141.      End
  142.      Begin PaneConfiguration = 9
  143.         NumPanes = 2
  144.         Configuration = "(H (1 [75] 4))"
  145.      End
  146.      Begin PaneConfiguration = 10
  147.         NumPanes = 2
  148.         Configuration = "(H (1[66] 2) )"
  149.      End
  150.      Begin PaneConfiguration = 11
  151.         NumPanes = 2
  152.         Configuration = "(H (4 [60] 2))"
  153.      End
  154.      Begin PaneConfiguration = 12
  155.         NumPanes = 1
  156.         Configuration = "(H (1) )"
  157.      End
  158.      Begin PaneConfiguration = 13
  159.         NumPanes = 1
  160.         Configuration = "(V (4))"
  161.      End
  162.      Begin PaneConfiguration = 14
  163.         NumPanes = 1
  164.         Configuration = "(V (2))"
  165.      End
  166.      ActivePaneConfig = 0
  167.   End
  168.   Begin DiagramPane =
  169.      Begin Origin =
  170.         Top = 0
  171.         Left = 0
  172.      End
  173.      Begin Tables =
  174.         Begin Table = "ItemLanguages"
  175.            Begin Extent =
  176.               Top = 6
  177.               Left = 38
  178.               Bottom = 160
  179.               Right = 191
  180.            End
  181.            DisplayFlags = 280
  182.            TopColumn = 0
  183.         End
  184.         Begin Table = "view1"
  185.            Begin Extent =
  186.               Top = 6
  187.               Left = 246
  188.               Bottom = 126
  189.               Right = 397
  190.            End
  191.            DisplayFlags = 280
  192.            TopColumn = 0
  193.         End
  194.      End
  195.   End
  196.   Begin SQLPane =
  197.   End
  198.   Begin DataPane =
  199.      Begin ParameterDefaults = ""
  200.      End
  201.      Begin ColumnWidths = 9
  202.         Width = 284
  203.         Width = 1500
  204.         Width = 1500
  205.         Width = 1500
  206.         Width = 1500
  207.         Width = 1500
  208.         Width = 1500
  209.         Width = 1500
  210.         Width = 1500
  211.      End
  212.   End
  213.   Begin CriteriaPane =
  214.      Begin ColumnWidths = 11
  215.         Column = 1440
  216.         Alias = 900
  217.         Table = 1170
  218.         Output = 720
  219.         Append = 1400
  220.         NewValue = 1170
  221.         SortType = 1350
  222.         SortOrder = 1410
  223.         GroupBy = 1350
  224.         Filter = 1350
  225.         Or = 1350
  226.         Or = 1350
  227.         Or = 1350
  228.      End
  229.   End
  230. End
  231. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'resultsView'
  232. GO
  233. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @VALUE=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'resultsView'
  234. GO
  235. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @VALUE=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
  236. Begin DesignProperties =
  237.   Begin PaneConfigurations =
  238.      Begin PaneConfiguration = 0
  239.         NumPanes = 4
  240.         Configuration = "(H (1[35] 4[26] 2[8] 3) )"
  241.      End
  242.      Begin PaneConfiguration = 1
  243.         NumPanes = 3
  244.         Configuration = "(H (1 [50] 4 [25] 3))"
  245.      End
  246.      Begin PaneConfiguration = 2
  247.         NumPanes = 3
  248.         Configuration = "(H (1 [50] 2 [25] 3))"
  249.      End
  250.      Begin PaneConfiguration = 3
  251.         NumPanes = 3
  252.         Configuration = "(H (4 [30] 2 [40] 3))"
  253.      End
  254.      Begin PaneConfiguration = 4
  255.         NumPanes = 2
  256.         Configuration = "(H (1 [56] 3))"
  257.      End
  258.      Begin PaneConfiguration = 5
  259.         NumPanes = 2
  260.         Configuration = "(H (2 [66] 3))"
  261.      End
  262.      Begin PaneConfiguration = 6
  263.         NumPanes = 2
  264.         Configuration = "(H (4 [50] 3))"
  265.      End
  266.      Begin PaneConfiguration = 7
  267.         NumPanes = 1
  268.         Configuration = "(V (3))"
  269.      End
  270.      Begin PaneConfiguration = 8
  271.         NumPanes = 3
  272.         Configuration = "(H (1[56] 4[18] 2) )"
  273.      End
  274.      Begin PaneConfiguration = 9
  275.         NumPanes = 2
  276.         Configuration = "(H (1 [75] 4))"
  277.      End
  278.      Begin PaneConfiguration = 10
  279.         NumPanes = 2
  280.         Configuration = "(H (1[66] 2) )"
  281.      End
  282.      Begin PaneConfiguration = 11
  283.         NumPanes = 2
  284.         Configuration = "(H (4 [60] 2))"
  285.      End
  286.      Begin PaneConfiguration = 12
  287.         NumPanes = 1
  288.         Configuration = "(H (1) )"
  289.      End
  290.      Begin PaneConfiguration = 13
  291.         NumPanes = 1
  292.         Configuration = "(V (4))"
  293.      End
  294.      Begin PaneConfiguration = 14
  295.         NumPanes = 1
  296.         Configuration = "(V (2))"
  297.      End
  298.      ActivePaneConfig = 0
  299.   End
  300.   Begin DiagramPane =
  301.      Begin Origin =
  302.         Top = 0
  303.         Left = 0
  304.      End
  305.      Begin Tables =
  306.         Begin Table = "Items"
  307.            Begin Extent =
  308.               Top = 8
  309.               Left = 226
  310.               Bottom = 110
  311.               Right = 377
  312.            End
  313.            DisplayFlags = 280
  314.            TopColumn = 0
  315.         End
  316.         Begin Table = "Languages"
  317.            Begin Extent =
  318.               Top = 6
  319.               Left = 38
  320.               Bottom = 108
  321.               Right = 189
  322.            End
  323.            DisplayFlags = 280
  324.            TopColumn = 0
  325.         End
  326.      End
  327.   End
  328.   Begin SQLPane =
  329.   End
  330.   Begin DataPane =
  331.      Begin ParameterDefaults = ""
  332.      End
  333.      Begin ColumnWidths = 9
  334.         Width = 284
  335.         Width = 1500
  336.         Width = 1500
  337.         Width = 1500
  338.         Width = 1500
  339.         Width = 1500
  340.         Width = 1500
  341.         Width = 1500
  342.         Width = 1500
  343.      End
  344.   End
  345.   Begin CriteriaPane =
  346.      Begin ColumnWidths = 11
  347.         Column = 1440
  348.         Alias = 1620
  349.         Table = 1170
  350.         Output = 720
  351.         Append = 1400
  352.         NewValue = 1170
  353.         SortType = 1350
  354.         SortOrder = 1410
  355.         GroupBy = 1350
  356.         Filter = 1350
  357.         Or = 1350
  358.         Or = 1350
  359.         Or = 1350
  360.      End
  361.   End
  362. End
  363. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'view1'
  364. GO
  365. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @VALUE=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'view1'
  366. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement