Skip to content
Loading
While I have insert value in databas table , New id should b
  • Hi,
     
    Create trigger and update perticular table column after insert the record
     
    Example : 
     
    CREATE TRIGGER AutoincTourID
    ON TABLENAME
    AFTER INSERT
    AS
    BEGIN
        SET NOCOUNT ON;
        DECLARE @USERID INT
        DECLARE @INSERTEDID INT
        DECLARE @TAID INT
           SELECT  @USERID =I.USERID     ,@TAID=FORMAT(CAST(TAID AS INT),'000','en-US'), @INSERTEDID =I.PRIMARYID
        FROM
            inserted i
        UPDATE TABLENAME SET COLUMNAME = USERID+@TAID WHERE ID =@INSERTEDID
  • TA is Tour claim id. which is 
     
    I have one project Tour and claim.
    here , While user insert details from taxt box then  id should be generate.  generate (009412001)009412 is emp id and 001.emp id and TA id both is table column name.
    like user insert empid-009412 then TA should be generate autoincreament 00941200
    1 ,009412002,009412003 etc.
  • Rupesh Kahane
    Do you have used Primary key?
    if yes then Is it auto incemental?
     
    What TA?
    Let us know what you are going to achieve so we can guide you  
  • Hi Kumar,
     
    Please elabrate the requirement clearly..