Statement causes error

BenTam 1,721 Reputation points
2024-03-16T08:29:12.0633333+00:00

Dear All,

What's wrong with the statement "create index engnamestuid on engname + cast(student as nvarchar(6))"?

TsqlError

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,652 questions
0 comments No comments
{count} votes

Accepted answer
  1. Olaf Helper 45,096 Reputation points
    2024-03-16T09:09:57.88+00:00

    DDL statements like CREATE INDEX requires fix literal, you can not use "calculated object names".

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.