Skip to navigation
How to create a primary key and link it from a foreign key in mssql
07.07.23
# How to create a primary key and link it from a foreign key in mssql ```sql ALTER TABLE [SL_h].[dbo].[kpi_log] ADD CONSTRAINT kpi_log_pri PRIMARY KEY (id); CREATE TABLE [SL_h].[dbo].[kpi_log_ln] ( id int NOT NULL IDENTITY(1,1) PRIMARY KEY ,kpi_log_id int NOT NULL DEFAULT 0 ,[value] NVARCHAR(255) NOT NULL DEFAULT '' constraint fk_kpi_log_id_kpi foreign key (kpi_log_id) references kpi_log (id) ) ```
https://www.techonthenet.com/sql_server/primary_keys.php
Reply
Anonymous
Information Epoch 1732420235
Effectiveness beats efficiency.
Home
Notebook
Contact us