Creating Tables

Although you will completely cover how to create a table in tomorrow's lesson, you need to know a bit about it in order to work with the remaining topics in today's lesson. When creating a table, you must define several attributes for each column in the table. The first thing you need to decide and define is the data type for the column. The title table has a title column that is defined as varchar and a price column that is defined as money. If you execute an sp_help on the table, you will see the data types for each column.

The next attribute would be the length for the data types that require it. Data types such as datetime, integer, smallinteger, and money have fixed lengths, so you do not need to set a length. Character ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.