Microsoft KB Archive/88931

= BUG: Inconsistent Timestamp Behavior in Stored Procedure =

Article ID: 88931

Article Last Modified on 2/14/2005

-

APPLIES TO


 * Microsoft SQL Server 4.21a Standard Edition

-



This article was previously published under Q88931



BUG# 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 (&quot;the user cannot insert a non-null value into a timestamp column&quot;) 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 (&quot;the user cannot insert a non-null value into a timestamp column&quot;).

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 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: kbprogramming KB88931

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.