USE [Resources02_def]
GO

IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=1212)
BEGIN
	INSERT [dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], 
	[fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], 
	[fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], 
	[fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) 
	VALUES (1212, N'tblDts', 32, N'License_Server', 1, 103, 50, N'License Server', 
	0, 0, N'Computer', 16, 1, 1, 1, NULL, 
	1, 1, NULL, N'License Server', NULL, N'cbo_1212_License_Server', 30, NULL, 
	0, -1, 1, NULL, NULL, NULL, 2, NULL)

END	
GO

IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=1213)
BEGIN
	INSERT [dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], 
	[fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], 
	[fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], 
	[fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) 
	VALUES (1213, N'tblDts', 32, N'Previous_Owner', 1, 103, 50, N'Previous Owner', 
	0, 0, N'tblUser', 16, 1, 1, 1, NULL, 
	1, 1, NULL, N'Previously Allocated to Person', NULL, N'cbo_1213_Previous_Owner', 30, N'Where (((([nID] >= 0 And  [tName]  <> '''') Or [tName]  = ''<User>'') And (Security_Type = 1 Or Security_Type = 8) And nStateID=1) Or [tName] = ''<None>'')', 
	0, -1, 1, NULL, NULL, NULL, 3, 'Previous Owner')
END

-- Use Supplier choice table in Service Contractor
UPDATE [dbo].[tblDtsFields] 
	SET [tFieldValuesTable] = 'Supplier',
	tWhere=''
	WHERE nID=923

	
GO







