Home

The Properties of a Column

   

Introduction

Column maintenance consists of reviewing or changing any of its aspects. This includes reviewing the structure of columns of a table, renaming a column, deleting a column, changing the data type or the nullity of a column, etc.

 

Column Review

To see the structure of a table in Microsoft Visual, in the Server Explorer, expand the connection to the desired database, expand the Tables node, and expand the table whose columns you want to see. Here is an example:

   

Column Review

To view the columns of a table using SQL code, in a query window, execute sp_columns followed by the name of the table the columns belong to.

The Column Properties 

A column on a table controls what kind of data is appropriate for that particular column. The characteristics that identify or describe such a table are defined as its properties. As we have seen previously, three primary properties are particularly important and required for each column: the name, the data type, and the length. Besides these, some other properties can be used to further control the behavior of a particular field.

Besides the name, the data type, and the length of a column, you can control the columns of a table using the Column Properties tab in the lower section of the table design view. These properties sometimes depend on the data type of the column. Therefore, to specify the properties of a column, you must first select it in the upper section of the table. This selection can be done by just clicking either the name, the data type, or the length of the column. Then you can either press F6 or click the first field in the lower section, select the desired property and type the necessary value:

Column Properties

 

Description

Description: Common and enabled for all fields, the description is used for a sentence that describes the column. You can type anything on that field.

Collation

Because different languages use different mechanisms in their alphabetical characters, this can affect the way some sort algorithms or queries are performed on data, you can ask the database to apply a certain language mechanism to the field by changing the Collation property.

To visually specify the language collation of a column, after selecting the column in the top section, in the lower section, click Collation and click the ellipsis button of its right field. This would open a Collation dialog box. You have two categorical options. To use a collation defined by the SQL, you can accept the SQL Collation radio button, and click the arrow of the top combo box to select the desired option:

Collation 

To specify these options using SQL, when programmatically creating the table, type COLLATE, followed by the desired collation code. Here is an example:

CREATE TABLE Customers(
    FullName varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS
);

As you can see, the SQL's collation can be hard to figure out. If you are using the Collation dialog box, you can click the Windows Collation radio button and click the arrow of the second combo box. This time, you would receive a list of familiar names of languages.

Besides the language of your choice, you can also specify the types of sort algorithms that you want the SQL interpreter to follow. The options are under the second combo box.

After making your selections, you can click OK.

 

Published on Monday 28 December 2007

 

Previous Copyright © 2007 FunctionX, Inc. Next