0

I am trying to rename the schema for a dozen tables in an old database on SQL Server 2005. I'm using SQL Server Management Studio Express version 9.0. Based on detailed advice found here, as well as several forums on other sites, I've been trying this straightforward command:

ALTER SCHEMA newschemaname TRANSFER oldschemaname.table1

I consistently get this error:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'SCHEMA'

It's the same whether I run it directly in the "New Query" window or build it into a stored procedure.

The database's owner is "SA," dating back to when my web host (the physical server's owner) first set up this database years ago. This makes me think there might be a permissions issue, or some obscure mismatch between the owner name and the login I'm using. But if that was true, I'd expect the error to tell me I don't have rights to execute that command.

Is there some obvious syntax error I'm missing, or do I need to delve deeper into the ownership and permissions to get the rights to fix this?

4

1 に答える 1

0

新しいスキーマ名は括弧で囲む必要があります。そうしないと失敗します

ステートメントの例: ALTER SCHEMA [NewSchemaName] TRANSFER dbo.Tracking

于 2018-01-23T17:11:19.587 に答える