How to add primary SQL Server key?

0

Good morning! maybe it's simple my question, but ... I would like to know how to add primary key in a table not being at creation time (CREATE), I know that when accessing the table in "object explorer" in the "design" option it is possible with two easily click's ... but would like to know even how to do via code. Thank you in advance.

    
asked by anonymous 01.08.2018 / 14:10

1 answer

2

Run the following table change code.

ALTER TABLE NOME_DA_TABELA ADD PRIMARY KEY (NOME_DO_CAMPO)
    
01.08.2018 / 14:17