HomeHardware Independent Imaging SolutionCommon ErrorsError 11 on Collect/Uniproc

8.3. Error 11 on Collect/Uniproc

Cause by an old version of the HIIS_Insert_FolderAssociations_General procedure using a like comparator rather than an = comparator. This error occurs when doing a comparison on a value with a control character in the driver name, for example HP Webcam [2.0 MP]. The square brackets are control characters for the Like comparator.

 

The solution:

Code:

ALTER PROCEDURE [dbo].[HIIS_Insert_FolderAssociations_General]
(
	@folderid int,
	@compid int,
	@provider varchar(8000),
	@platform varchar(8000),
	@devicename varchar(8000)	
)
AS
	declare @providerid int
	declare @platformid int
	declare @devicenameid int
	declare @lincount int
	declare @count int
	select @count = count([AssociationId]) from [HIIS_Folders_ProviderNames]
		where lower(@provider) LIKE lower([ProviderName])

	if @count = 0
	BEGIN
		insert into [HIIS_Folders_ProviderNames] ([ProviderName]) Values (@provider)
	END
	select @providerid = [AssociationId] from [HIIS_Folders_ProviderNames]
		where lower(@provider) = lower([ProviderName])

	select @count = count([AssociationId]) from [HIIS_Folders_Platforms]
		where lower(@platform) = lower([Platform])

	if @count = 0
	BEGIN
		insert into [HIIS_Folders_Platforms] ([Platform]) Values (@platform)
	END
	select @platformid = [AssociationId] from [HIIS_Folders_Platforms]
		where lower(@platform) = lower([Platform])
		
	select @count = count([AssociationId]) from [HIIS_Folders_DeviceNames]
		where lower(@devicename) = lower([DeviceName])

	if @count = 0
	BEGIN
		insert into [HIIS_Folders_DeviceNames] ([DeviceName]) Values (@devicename)
	END
	select @devicenameid = [AssociationId] from [HIIS_Folders_DeviceNames]
		where lower(@devicename) = lower([DeviceName])

-----Checking if updated
Select @lincount = count(*)  from HIIS_Folders_Associations where 
		@folderid = FolderId AND 
		@devicenameid = AssociationId AND 
		1 = Associationtype
if @lincount = 0
BEGIN
	update HIIS_Folders set lastupdated = getdate() where
		[FolderId] = @folderid
END
------------------------------------
	insert into [HIIS_Folders_Associations]
		(
			[FolderId],
			[AssociationId],
			[Associationtype]
		)
		select a, b, c from (Select count(*) as linecount, @folderid a, @devicenameid b, 1 c from HIIS_Folders_Associations where 
					@folderid = FolderId AND 
					@devicenameid = AssociationId AND 
					1 = Associationtype) x
			where x.linecount = 0

-----Checking if updated
Select @lincount = count(*)  from HIIS_Folders_Associations where 
		@folderid = FolderId AND 
		@platformid = AssociationId AND 
		2 = Associationtype
if @lincount = 0
BEGIN
	update HIIS_Folders set lastupdated = getdate() where
		[FolderId] = @folderid
END
------------------------------------

	insert into [HIIS_Folders_Associations]
		(
			[FolderId],
			[AssociationId],
			[Associationtype]
		)
		select a, b, c from (Select count(*) as linecount, @folderid a, @platformid b,2 c from HIIS_Folders_Associations where 
					@folderid = FolderId AND 
					@platformid = AssociationId AND 
					2 = Associationtype) x
			where x.linecount = 0
-----Checking if updated
Select @lincount = count(*)  from HIIS_Folders_Associations where 
		@folderid = FolderId AND 
		@providerid = AssociationId AND 
		4 = Associationtype
if @lincount = 0
BEGIN
	update HIIS_Folders set lastupdated = getdate() where
		[FolderId] = @folderid
END
------------------------------------
	insert into [HIIS_Folders_Associations]
		(
			[FolderId],
			[AssociationId],
			[Associationtype]
		)
		select a, b, c from (Select count(*) as linecount, @folderid a, @providerid b,4 c from HIIS_Folders_Associations where 
					@folderid = FolderId AND 
					@providerid = AssociationId AND 
					4 = Associationtype) x
			where x.linecount = 0

	insert into [HIIS_Folders_Associations]
		(
			[FolderId],
			[AssociationId],
			[Associationtype]
		)
		Select @folderid, [HIIS_ReferenceClass].[ID],50 from [HIIS_ReferenceClassGrp],[HIIS_ReferenceClass]
			where @compid = [HIIS_ReferenceClassGrp].[Computer_id] AND 
				[HIIS_ReferenceClassGrp].[ProfID]=[HIIS_ReferenceClass].[ProfID] AND
				[HIIS_ReferenceClassGrp].[ReferenceClassUID]=[HIIS_ReferenceClass].[ReferenceClassID] AND
				[HIIS_ReferenceClassGrp].[Candidate]=1 AND
				[HIIS_ReferenceClass].[ID] not in 
					(select [AssociationId] from [HIIS_Folders_Associations] 
						where [FolderId]= @folderid AND ([Associationtype]=50 OR [Associationtype]=60))
GO

This page was: Helpful | Not Helpful