dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Get-DbaDbColumn and Get-DbaDbPrimaryKey

Open catadumitru opened this issue 5 years ago • 2 comments

Summary of new feature

Being able to get column names from a table and more importantly the PrimaryKey(s) of a table.

Latest version of dbatools as of writing

1.0.153

  • Please provide the latest released version of dbatools module. 1.0.153

catadumitru avatar May 31 '21 12:05 catadumitru

Using Get-DbaDbTable you can do this:

$table = Get-DbaDbTable -SqlInstance SRV1\SQL2017 -Database AdventureWorks -Table 'Person.Person' 
$table.Columns | Format-Table -Property Name, InPrimaryKey, Datatype

image

What else would you like to have?

andreasjordan avatar Jun 04 '21 10:06 andreasjordan

I also found a way to get the data needed in the end. I was suggested to request this as a new command in the dbatools slack channel. But I guess it's not that important if you can achieve your results with the current commands.

Thanks!

catadumitru avatar Jun 11 '21 07:06 catadumitru