﻿  --If any StreamOutput sensor already has an advanced Stream Profile, add (if non-existent)
  --or update, DefaultUseAdvancedUDPStreamProfiles = True, in the DefaultProperties table.
  --This will cause it to be set to True in the UserProperties table automatically, later when needed.
  IF ((SELECT COUNT(*) FROM SensorsStreamOutput WHERE StreamProfile <> 'CH10_ANALOG_2HDR' AND StreamProfile <> 'CH10_PCM_128BIT_2HDR') > 0)
  BEGIN
	--Add to or Update DefaultProperties table
	IF ((SELECT COUNT(*) FROM DefaultProperties WHERE PropertyName = 'DefaultUseAdvancedUDPStreamProfiles') = 0)
	BEGIN
		--Add to table
		INSERT INTO DefaultProperties VALUES (492, 'DefaultUseAdvancedUDPStreamProfiles', 'True');
	END
	ELSE
	BEGIN
		--Update existing entry
		UPDATE DefaultProperties SET DefaultValue = 'True' WHERE PropertyName = 'DefaultUseAdvancedUDPStreamProfiles';
	END
  END