O'Reilly logo

Microsoft SQL Server 2014 Unleashed by Paul Bertucci, Alex T. Silverstein, Chris Gallelli, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using T-SQL to Create Tables

Ultimately, all the tables created with the visual tools can also be created by using T-SQL. As with many of the SSMS tools, database objects can be resolved or scripted into T-SQL statements. Let’s examine the T-SQL syntax to better understand some of the table creation options; then we can discuss the definition of the columns in each table.

The full T-SQL CREATE TABLE syntax is extensive. It includes options to define table constraints, indexes, and index options. The SQL Server Books Online topic named “CREATE TABLE (Transact-SQL)” shows the full syntax and describes each of these options in detail. Listing 21.1 shows the basic T-SQL syntax; the first part of the syntax is listed in Books Online. This syntax is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required