Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AlterDataType Method

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

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

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


Expression that evaluates to an object in the Applies To list.


String that specifies the new data type.


Optional long integer that specifies the length of a string data type.


Optional long integer that specifies the precision of a numeric data type.


Optional long integer that specifies the scale of a numeric data type.

HRESULT AlterDataType(
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.


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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft