Quantcast
Channel: Computed Column Bug?
Viewing all articles
Browse latest Browse all 2

Computed Column Bug?

$
0
0

Hi All,

      Just putting together a prototype Data Warehouse using the Nov CTP of SQL 2008 and was wondering if the following is a bug or if it's changed from SQL 2005. I've simplified the following examples.

 

Method 1 - Create table and then modify the column

 

Create the table using the following statement

 

CREATE

TABLE

TAB1

(

CalendarDate Date

NOTNULL,

DayOfWeek tinyint

NOTNULL

)

 

Go into management studio and modify the table, putting the following formula in the computed column specification of the "DayOfWeek" column.

 

(DATEPART(dw,CalendarDate))

 

This fails when you move the focus away from the computed column specification box with the error message "Error validating the formula for column DayOfWeek"

 

Method 2 - Create the table with the following statement, including the computed column specification in the SQL script

 

CREATETABLE

TAB2

(

CalendarDate Date

NOTNULL,

DayOfWeek

AS DATEPART(dw,CalendarDate)

)

 

This works and the computed column is created ok.

 

Any ideas if I'm doing anything wrong in Management studio or if it's a bug?

 

Thanks

 

Nick Colebourn

MCDBA SQL 2000, MCTS SQL 2005


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images