Advertisement
bluebunny72

UET Create Script

Feb 3rd, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 4.28 KB | None | 0 0
  1. --**********Check if UET field already exists
  2. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_fld] WHERE [fld_name] = 'Uf_ILC_Timesheet')
  3.  
  4.     --Create the UET field
  5.     INSERT INTO [dbo].[user_fld] ([fld_name],[fld_data_type],[fld_initial],[fld_decimals],[fld_desc],[fld_UDT],[fld_prec])
  6.     VALUES ('Uf_ILC_Timesheet','tinyint','0',NULL,'Boolean flag indicating if entry came via timesheet','ILC_BooleanType',NULL)
  7. ELSE
  8.     --Update the UET field
  9.     UPDATE [dbo].[user_fld] SET [fld_data_type] = 'tinyint', [fld_initial] = '0', [fld_decimals] = NULL, [fld_desc] = 'Boolean flag indicating if entry came via timesheet'
  10.     ,[fld_UDT] = 'ILC_BooleanType', [fld_prec] = NULL WHERE [fld_name] = 'Uf_ILC_Timesheet'
  11.  
  12.  
  13.  
  14.  
  15. --**********UET Classes
  16.  
  17. --Check if UET Class already exists
  18. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class] WHERE [class_name] = 'ILC_JobTran')
  19.  
  20.     --Create the UET class
  21.     INSERT INTO [dbo].[user_class] ([class_name],[class_label],[class_desc])
  22.     VALUES ('ILC_JobTran','ILC_JobTran',NULL)
  23.  
  24. ELSE
  25.     PRINT('UET Class already exists')
  26.  
  27. --Check if UET Class already exists
  28. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class] WHERE [class_name] = 'ILC_Projlabr')
  29.  
  30.     --Create the UET class
  31.     INSERT INTO [dbo].[user_class] ([class_name],[class_label],[class_desc])
  32.     VALUES ('ILC_Projlabr','Projlabr','Projlabr')
  33.  
  34. ELSE
  35.     PRINT('UET Class already exists')
  36.  
  37. --Check if UET Class already exists
  38. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class] WHERE [class_name] = 'ILC_Projtran')
  39.  
  40.     --Create the UET class
  41.     INSERT INTO [dbo].[user_class] ([class_name],[class_label],[class_desc])
  42.     VALUES ('ILC_Projtran','ILC_Projtran',NULL)
  43.  
  44. ELSE
  45.     PRINT('UET Class already exists')
  46.  
  47.  
  48.  
  49.  
  50. --**********UET Class Field Relationship
  51.  
  52. --Check if UET Class Field relationship already exists
  53. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class_fld] WHERE [class_name] = 'ILC_JobTran' AND [fld_name] = 'Uf_ILC_Timesheet')
  54.  
  55.     --Create the UET Class Field relationship
  56.     INSERT INTO [dbo].[user_class_fld] ([class_name],[fld_name])
  57.     VALUES ('ILC_JobTran','Uf_ILC_Timesheet')
  58.  
  59. ELSE
  60.     PRINT('UET Class-Field relationship already exists')
  61.  
  62. --Check if UET Class Field relationship already exists
  63. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class_fld] WHERE [class_name] = 'ILC_Projlabr' AND [fld_name] = 'Uf_ILC_Timesheet')
  64.  
  65.     --Create the UET Class Field relationship
  66.     INSERT INTO [dbo].[user_class_fld] ([class_name],[fld_name])
  67.     VALUES ('ILC_Projlabr','Uf_ILC_Timesheet')
  68.  
  69. ELSE
  70.     PRINT('UET Class-Field relationship already exists')
  71.  
  72. --Check if UET Class Field relationship already exists
  73. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[user_class_fld] WHERE [class_name] = 'ILC_Projtran' AND [fld_name] = 'Uf_ILC_Timesheet')
  74.  
  75.     --Create the UET Class Field relationship
  76.     INSERT INTO [dbo].[user_class_fld] ([class_name],[fld_name])
  77.     VALUES ('ILC_Projtran','Uf_ILC_Timesheet')
  78.  
  79. ELSE
  80.     PRINT('UET Class-Field relationship already exists')
  81.  
  82.  
  83.  
  84.  
  85. --**********UET Table Class Relationship
  86.  
  87. --Check if UET Table Class relationship already exists
  88. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[table_class] WHERE [TABLE_NAME] = 'jobtran' AND [class_name] = 'ILC_JobTran')
  89.  
  90.     --Create the UET Table Class relationship
  91.     INSERT INTO [dbo].[table_class] ([TABLE_NAME],[class_name],[table_rule],[extend_all_recs],[active])
  92.     VALUES ('jobtran','ILC_JobTran',NULL,0,1)
  93.  
  94. ELSE
  95.     PRINT('UET Table-Class relationship already exists')
  96.  
  97. --Check if UET Table Class relationship already exists
  98. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[table_class] WHERE [TABLE_NAME] = 'projlabr' AND [class_name] = 'ILC_Projlabr')
  99.  
  100.     --Create the UET Table Class relationship
  101.     INSERT INTO [dbo].[table_class] ([TABLE_NAME],[class_name],[table_rule],[extend_all_recs],[active])
  102.     VALUES ('projlabr','ILC_Projlabr',NULL,0,1)
  103.  
  104. ELSE
  105.     PRINT('UET Table-Class relationship already exists')
  106.  
  107. --Check if UET Table Class relationship already exists
  108. IF NOT EXISTS(SELECT TOP 1 1 FROM [dbo].[table_class] WHERE [TABLE_NAME] = 'Projtran' AND [class_name] = 'ILC_Projtran')
  109.  
  110.     --Create the UET Table Class relationship
  111.     INSERT INTO [dbo].[table_class] ([TABLE_NAME],[class_name],[table_rule],[extend_all_recs],[active])
  112.     VALUES ('Projtran','ILC_Projtran',NULL,0,1)
  113.  
  114. ELSE
  115.     PRINT('UET Table-Class relationship already exists')
  116.  
  117.  
  118.  
  119. PRINT('Do NOT forget to Impact Schema via SyteLine form')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement