共用方式為


AlterDataType Method

未來的 Microsoft SQL Server 發行版本將不再提供此功能。請避免在新的開發工作中使用此功能,並計劃修改目前使用此功能的應用程式。

The AlterDataType method alters the data type of the referenced column.

語法

object
.AlterDataType(
Datatype
, [ Length ] , [ Precision ] , [ Scale ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • DataType
    String that specifies the new data type.
  • Length
    Optional long integer that specifies the length of a string data type.
  • Precision
    Optional long integer that specifies the precision of a numeric data type.
  • Scale
    Optional long integer that specifies the scale of a numeric data type.

Prototype (C/C++)

HRESULT AlterDataType(
SQLDMO_LPCSTR DataType, 
long Length,
long Precision,
long Scale);

備註

When using AlterDataType to convert the data type of an existing column to a new data type, the two data types must be compatible. For example, an int data type can be converted to a decimal data type, and a char data type can be converted to an nvarchar data type. However string data types cannot be converted to numeric data types.

ms144573.note(zh-tw,SQL.90).gif附註:
If an application calls AlterDataType on an instance of SQL Server version 7.0, the constant, SQLDMO_E_SQL80ONLY, and the message "This property or method requires Microsoft SQL Server 2000" are returned.

Applies to:

Column2 Object

請參閱

參考

Datatype Property

說明及資訊

取得 SQL Server 2005 協助