created a getdate calculated column

I want to create a table with a getdate column in it. So when the data comes in everyday, it should show the current date for that item.. (want to start new Inventory table)

5replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Jacob Mathew ! SQL has methods for adding the current date, but that will simply give you the date when you run the query (not when the record was added to the database). This sounds like something that would need to happen upstream (in Spark or a similar program) to include this information. Your database administrator would be the best person to add this detail in. I'll also defer to anyone on the community who has experience building tables and adding such information in!

    Reply Like
  • Thanks, Neha... Actually, I created the tables with a calculated column, but it is giving me duplicates every time it runs.

    Reply Like
      • Neha Kumar
      • Solutions Engineer
      • Neha_Kumar
      • 5 mths ago
      • Reported - view

      Jacob Mathew Interesting! Duplicates as in we are seeing multiple copies of the same rows appear after adding the date column? Could you share the calculation used?

      Reply Like
    • Neha Kumar CREATE TABLE [ods].[hisassetloccust](

      [assetlocusercustid] [bigint] NOT NULL,
          [assetnum] [varchar](12) NULL,
          [iscustodian] [smallint] NOT NULL,
          [location] [varchar](22) NULL,
          [personid] [varchar](20) NOT NULL,
          [rowstamp] [timestamp] NOT NULL,
      DateCreated DATETIME NOT NULL DEFAULT(GETDATE())
      )

      Reply Like
    • Neha Kumar Hi Neha. Any idea on how I can show the current date, without time in a new column for the assets and whenever the asset is updated, the new column should show the updated asset along with assetnum, location, personid, and 'New Column'. 

      Reply Like
Like Follow
  • 4 mths agoLast active
  • 5Replies
  • 27Views
  • 2 Following