sql server - Combine two columns of a table in third column -


i want create table wherein 'id' column combined 'category' column , gets stored in 'userid' column. here example.

id    category    userid 1     std         std1 2     nmm         nmm2 3     cov         cov3 

i have tried :

 create table tblusers  (    id int identity primary key,    regid right('0000'+cast([id] varchar(5)),5),    category nvarchar(3),    userid concat(categoryinitials,id)  ) 

but doesnt work. so, how work while creating table?

may this:

create table tblusers  (  id int identity primary key,  category nvarchar(3),  userid (category + cast(id varchar(10)))  ) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -