BUG: INSERT/SELECT with Union into Table with Nullable DATETIME

Article translations Article translations
Article ID: 223403 - View products that this article applies to.
This article was previously published under Q223403
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 18664 (SQLBUG_65)
Expand all | Collapse all

Symptoms

When running an INSERT/SELECT query that contains a UNION into a table with a timestamp column that has been declared as nullable, two rows will be inserted for each row that qualifies under the select statement. One row will contain a nulled timestamp, the other will contain an actual timestamp.

Workaround

To work around this problem, declare the timestamp column as NOT NULL.

Status

Microsoft has confirmed this to be a problem in SQL Server 6.5.

More information

To reproduce this problem, run this script:
CREATE TABLE t1
(c1     INT)
go

INSERT t1
VALUES (1)
go

CREATE TABLE t2
(c1    INT,
c2     TIMESTAMP NULL)
go

INSERT INTO t2 (c1)
SELECT DISTINCT c1
FROM t1
UNION
SELECT DISTINCT c1
FROM t1
				

Properties

Article ID: 223403 - Last Review: November 2, 2013 - Revision: 4.0
Applies to
  • Microsoft SQL Server 6.5 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbpending KB223403

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com