Home Dashboard Directory Help
Search

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


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 795491
Opened: 7/31/2013 4:02:48 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

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;



Details
Sign in to post a comment.
Sign in to post a workaround.