BUG: Inconsistent Timestamp Behavior in Stored Procedure

Last reviewed: April 28, 1997
Article ID: Q88931

The information in this article applies to:
  • Microsoft SQL Server version 4.2 for OS/2
  • Microsoft SQL Server, versions 4.2, 4.21, and 4.21a
BUG# OS/2: 1488 (4.2)
       NT:  881 (4.2)

SYMPTOMS

When you copy a table that has a timestamp column into another table by executing the following queries in a stored procedure, you may get error 273 ("the user cannot insert a non-null value into a timestamp column") the second time you run the procedure.

   SELECT * INTO table1
      FROM table2
      WHERE 1=2
   INSERT INTO table2
      SELECT * FROM table1

The stored procedure works well the first time. But if you drop table2 and rerun the stored procedure, SQL Server gives you error 273 ("the user cannot insert a non-null value into a timestamp column").

Then if you drop table2 again and rerun the stored procedure, it works correctly.

It always works correctly when SQL Server does not copy the timestamp columns from table1 but instead creates new timestamp columns.

WORKAROUND

In the INSERT statement, list all table1's columns except the timestamp column.

STATUS

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


Additional query words: Transact-SQL datatype timestamp
Keywords : kbbug4.20 kbbug4.21 kbbug4.21a kbprg SSrvServer SSrvWinNT
Version : 4.2 | 4.2 4.21 4.21a
Platform : OS/2 WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.