USE [Resources02_def]
GO

-- Connect As
IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=101)
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 (101, N'tblDts', 32, N'Connect_As', 1, 10, 50, 
	N'Connect As', 0, 0, NULL, NULL, 1, 1, 
	1, NULL, 1, 1, NULL, N'Connect As', NULL, 
	N'101', 3, NULL, 0, -1, 1, NULL, 
	NULL, NULL, 3, 'Connect_As');	
END	

-- Password
IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=102)
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 (102, N'tblDts', 32, N'Password', 1, 115, 50, 
	N'Password', 0, 0, NULL, 0, 1, 0, 
	1, NULL, 0, 1, 0, N'Password', NULL, 
	N'77', 39, NULL, 1, -1, 1, NULL, 
	NULL, NULL, 1, N'Password');
			
END	


IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=103)
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 (103, N'tblDts', 32, N'PCD_HostId', 1, 10, 50, 
	N'PCDUO Host ID', 0, 0, NULL, NULL, 1, 1, 
	1, NULL, 1, 1, NULL, N'PCDUO Host ID', NULL, 
	N'103', 35, NULL, 0, -1, 1, NULL, 
	NULL, NULL, 2, N'PCDUO Host ID');
		
END	
	
IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=104)
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 (104, N'tblDts', 32, N'Public_Host_Name', 1, 10, 255, 
	N'Public Host Name', 0, 0, NULL, NULL, 1, 1, 
	1, NULL, 1, 1, NULL, N'Public Host Name', NULL, 
	N'104', 26, NULL, 0, -1, 1, NULL, 
	NULL, NULL, 2, N'Public Host Name');
		
END	

IF NOT EXISTS ( SELECT nID FROM [dbo].[tblDtsFields]  WHERE nID=105)
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 (105, 'tblDts', 32, 'Unauthorized_In_Organization' , 1 , 103, 50, 
	'Unauthorized In Organization', 0, 0, 'tblYesNo', 16, 1, 1, 
	1, NULL, 1, 1, NULL, 'Unauthorized In Organization', NULL,
	'105', 3, NULL,0,-1,1, NULL,
	NULL, NULL,2, 'Unauthorized In Organization');
	
END	
	
GO


-- Remove Allocated to Device / Computer (Bulk Allocate) and Allocated to Person (Bulk Allocate) fields (no longer used)
DELETE FROM tblDtsFields WHERE nID=1100 AND tName='nUserID' AND nDataType=104
GO

DELETE FROM tblDtsFields WHERE nID=1101 AND tName='Allocated_to_Device___Computer' AND nDataType=104
GO






