Microsoft KB Archive/97147

{|
 * width="100%"|

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

BUG# OS/2: 1648 (4.2)

SYMPTOMS
When inserting records into a table and using a default to fill in a column with a value derived from a system variable, SQL Server experiences a general protection fault (GP fault).

CAUSE
If a default of the following form is used to fill in values in a column, the server will GP fault:

create default problem_default as @@spid If values are specified for the column so that the default is not used to insert a value into the field, a trap will not occur. A default that produces a value derived from a system variable, such as  create default problem_default as convert( char(10), @@spid ) will produce a trap.

WORKAROUND
If you want a record of the current @@spid, a trigger should be created on the table to update the inserted records with the desired @@spid. If you want to make record of the user inserting the record, you can use system functions such as USER_ID, SUSER_ID, and HOST_ID within a default to identify the creator.

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.