From the course: PowerShell for SQL Server Administration

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating tables

Creating tables - PowerShell Tutorial

From the course: PowerShell for SQL Server Administration

Start my 1-month free trial

Creating tables

- [Narrator] All right, so the next step after we've created our databases is to go ahead and create tables. So again, we've got two options we can use, we either use SQLPS in combination with SMO to go ahead and create that new object, or we can use just the native T-SQL to go ahead and create that object using the CREATE TABLE syntax. So if we SQLPS again, this is more the PowerShell style command to actually create the object, and we create the object, we create the columns, that are within that object, and then we tell it to go ahead and execute that against the SQL server. Under the covers, all it's going to do is the CREATE TABLE statement. So if you're in a profiler trace or an exinence trace on the server while you're running that SQLPS command, it would literally just run CREATER TABLE. We're going to go and do that through the actual native SQLPS cmdlets to actually create that object. Then we're going to go back and we're going to look at some actual CREATE TABLE statements…

Contents