ODBC escape sequences and computed columns cause metadata confusion. - by Martin Smith

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 795491 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/31/2013 4:02:48 AM
Access Restriction Public

Description

I suppose this is a bug so have reported it. 

The reason I came across the issue was because I wondered if using this syntax would avoid the need to use CONVERT with a style parameter for datetime literals in a persisted computed column.

The computed column is created but accessing the table causes the message

Metadata stored on disk for computed column 'Y' in table 'T' did not match the column definition. In order to avoid possible index corruption, please drop and recreate this computed column.

USE tempdb;

CREATE TABLE T
(
X INT,
Y AS {ts '2013-09-30 23:59:59'}
)

/*Shows datetime*/
SELECT c.definition, t.name 
FROM sys.computed_columns c
JOIN sys.types t ON c.system_type_id = t.system_type_id
WHERE object_id = object_id('T')


INSERT INTO T(X) VALUES(1);

/*Shows varchar*/
SELECT SQL_VARIANT_PROPERTY ( Y , 'BaseType' ) 
FROM T

DROP TABLE T;



Sign in to post a comment.