Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8318963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:09:27+00:00 2026-06-08T22:09:27+00:00

I have a table for Contacts that I’m storing for customers with columns: Addressline1

  • 0

I have a table for Contacts that I’m storing for customers with columns:

  • Addressline1
  • Addressline2
  • CityID
  • EmpID (FK)
  • ModifiedDate (Computed, DateTime)

I use ASP.NET 4.0 and in the form I have used ASP.NET wizard with 3 steps. I have few problems.

  1. How do I insert EmpID into a table dbo.Contacts where EmpID is a FK.
  2. How to store ModifiedDate ? What is the sqlparameter to add the Time value?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:09:29+00:00Added an answer on June 8, 2026 at 10:09 pm

    You have basically two choices to keep a ModifiedDate up to date:

    1. define a DEFAULT constraint on that column to get the current date/time when you freshly insert a row, and create an AFTER UPDATE trigger to update the ModifiedDate after every update operation on that row

    2. set the ModifiedDate in your client application before every save operation to the database

    Update: if you want to create an AFTER UPDATE trigger, use code something like this:

    CREATE TRIGGER trg_UpdateModifiedDate
    ON dbo.YourTableHere
    AFTER UPDATE
    AS
         UPDATE dbo.YourTableHere
         SET ModifiedDate = GETDATE()
         WHERE AddressID IN (SELECT AddressID FROM Inserted)
    

    Here, I’m assuming your table YourTableHere has some kind of a primary key – a column like an ID that uniquely and clearly identifies each single row. Based on that row, you can update the ModifiedDate of all those rows that have been updated by a given SQL statement. Inserted is a pseudo table that’s available inside a trigger code body, which contains all the rows that have been modified by the operation that caused this trigger to fire (all rows affected by your UPDATE statement on YourTableHere)

    Read more about triggers here:

    • An Introduction to Triggers
    • MSDN documentation on CREATE TRIGGER
    • SQL Trigger Example in SQL Server 2008

    Update #2: if your ModifiedDate column is in fact computed on the SQL Server table level, you cannot update it directly. You’ll need to find out what it’s computed from, and then you need to modify that column (if you can).

    To find out what it’s computed from, run this query on your SQL Server database:

    SELECT 
        c.name, c.is_computed, c.definition
    FROM 
        sys.computed_columns c
    WHERE 
        object_id = OBJECT_ID('dbo.Contacts')
        AND c.Name = 'ModifiedDate'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table, contacts, that has a dozen columns or so. I want
I have a table contacts that has a field arrayOfMembers (JSON format) and a
I have a database named contacts.db with a table named TABLE_NAME that has one
Greetings, stack overflow In my database, I already have one table, 'contacts' that contains
I have a portal in my contacts table layout that shows related mention in
So i have a mysql query that queries a table contacts each contact then
I'm new in Cocoa. I have a table that stores Contacts. I'm not using
I have an existing table of contacts that has about 140k records in it.
I have a table of contacts and a table of postcode data. I need
I have a contacts table: ID NAME --- ---- 1 KK 2 JKI 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.