Quantcast
Channel: Database Design forum
Viewing all articles
Browse latest Browse all 2729

How to set computed field as primary key ?

$
0
0

I have created Brand_Mast Table , I ve want to create Brand_Code as Primary Key, but it is computed field

How can i set Brand_Code as Primary Key  ?

CREATE TABLE [dbo].[Brand_Mast](

[id] [int] IDENTITY(1,1) NOT NULL,

[Brand_Code]  AS ('BR'+right('00000'+CONVERT([varchar](3),[id],(0)),(5))),

      [Brand_name] [varchar](75) NOT NULL, )


Viewing all articles
Browse latest Browse all 2729


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>