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

java - Incorrect order of records in M-M relationship in hibernate -

command line - Use qwinsta in PowerShell ISE -

php - I want to create a website for polls/survey like this http://www.poll-maker.com/ -