Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Create Column in SQL Server

$
0
0

Hi all,

     I am having below table.

 
create table Student_Register
(
  Name varchar(30),
  FatherName varchar(35),
  Address1 varchar(100),
  Address2 varchar(100),
  Place varchar(75),
  Pincode int,
  SchoolName varchar(100),
  StandardStudy varchar(15)
)

I am creating after trigger on the above table and inserting into the below table.

create table StudentDetails
(
  Name varchar(30),
  FatherName varchar(35),
  Address1 varchar(100),
  Address2 varchar(100),
  Place varchar(75),
  Pincode int,
  SchoolName varchar(100),
  StandardStudy varchar(15)
)

I need to create one computed column in studentdetails as StudentID with StandardStudy+Replicate(0,3)+lastvalue+1

5th student id

50001

50002

 12th student like

120001

120002

120003

how to implement above logic pls ?

Thanks

Selvaons


Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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