Microsoft KB Archive/94596

{|
 * width="100%"|

The information in this article applies to:
 * Microsoft SQL Server versions 4.2 and 4.2a for OS/2

BUG# OS/2: 1562 (4.2)

SYMPTOMS
A stored procedure doing a select in conjunction with the count and distinct functions may cause a general protection fault (GP fault) on SQL Server. Furthermore, the stored procedure may have executed multiple times on the server without its actually bringing the server down every time.

The stored procedure definition must be like the following:

create procedure test_proc as  select count(distinct  column1+column2) from table1 where ... (Assume that both column1 and column2 are defined as char(2).)

WORKAROUND
To avoid potential GP faults with the above stored procedure, it may be recoded by selecting into a temporary table and then performing the &quot;distinct&quot; on the temporary table (the 'distinct column1+column2' is the source of the problem):

create procedure test_proc as  begin

create table #temp_sum (sum1 char(4))

insert into #temp_sum select column1+column2 from table1

select count(distinct sum1) from #temp_sum end

STATUS
Microsoft has confirmed this to be a problem in SQL Server versions 4.2 and 4.2a for OS/2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
 * }

-

Last reviewed: May 5, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.