-1

So I have a database in SQL that looks like this:

UID FILE_DATE_PROCESSED FILE_NAME DATE_ENTERED

In this database, every time I add a file, column 2 should contain the last time I entered the file, and column 4 should contain the time I am entering the file now.

My problem is, I do not know how to get those columns to do that. For example: when I try to put in a starting date, it keeps giving me an error that the cell is null, and after trying everything I could think of I can't get rid of that error message. So my first question is, for the result that I want, do I do this in SQL or do I do this in my c# console application, and my second question is what is the syntax that I need in order to get this accomplished. Below I have an example of what I am looking for as a result:

UID   FILE_DATE_PROCESSED  FILE_NAME DATE_ENTERED
random year/month/day time  filename  current time
BrianAtkins
  • 1,279
  • 9
  • 17
user4970927
  • 179
  • 8
  • possible duplicate of [Writing information from SQL Server to C#](http://stackoverflow.com/questions/30742494/writing-information-from-sql-server-to-c-sharp) – James Z Jun 10 '15 at 15:06

1 Answers1

1

Here's a SQL snippet that should insert into those columns:

INSERT mytable (UID, FILE_DATE_PROCESSED, FILE_NAME, DATE_ENTERED)
SELECT newid(), '2015-12-31 19:32:45', 'myfilename.txt', getdate()
TobyLL
  • 2,098
  • 2
  • 17
  • 23