How to write a trigger

  • i just want write a trigger for adding two text box field then put the result into the third text box in the same page how can i do that?

  • For a good introduction to triggers in SQL, please read this: http://www.sqlservercentral.com/articles/Triggers/64214/

    I also have to ask, why do you want to do this? Storing redundant data is usually a bad idea. You can regenerate the added columns easily when selecting from the table, or you could use a calculated column. Why store the duplicate and go through the hassle of keeping it updated?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi

    You are asking for SQL or for .Net ,If you are asking for SQL then Give me any Example related to that.

    Thanks
    Parthi

  • iam asking Sql

  • i have three text boxes

    1.start date

    2.planned days

    3.end date

    now i enter the first two field the end date will show automatically sum of start date and planned days

  • manikandan.chokkalingam (11/30/2009)


    i have three text boxes

    Doesn't sound like SQL to me. SQL has no text boxes. Maybe you can give us some more information, including where these 'text boxes' appear. The table structure would also be useful.

    Again, I'm going to ask, if this is in SQL, why do you want to store redundant data?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I think this is thing you are looking for as per your Requirement

    DECLARE @STARTDATE DATETIME

    DECLARE @ENDDATE DATETIME

    DECLARE @PLANNED SMALLINT

    SET @STARTDATE ='12/01/2009'

    SET @PLANNED=10

    SELECT @ENDDATE=DATEADD(dy,@PLANNED,@STARTDATE)

    SELECT CONVERT(VARCHAR,@ENDDATE,101)

    Thanks
    Parthi

  • Thank U

  • When ever You post on Development You better post with example so that we can get the idea ,so that you might get the result sooner

    Thanks
    Parthi

  • Yeah sure.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply