October 26, 2012 at 2:44 pm
my table need to store timestamp in 1 column, for the record,
hwo to create timestamp in sql create table
October 26, 2012 at 2:53 pm
harri.reddy (10/26/2012)
my table need to store timestamp in 1 column, for the record,hwo to create timestamp in sql create table
http://msdn.microsoft.com/en-us/library/ms182776%28v=sql.90%29.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
October 26, 2012 at 3:07 pm
harri.reddy (10/26/2012)
my table need to store timestamp in 1 column, for the record,hwo to create timestamp in sql create table
Make sure you know what you mean by "timestamp".
TIMESTAMP is a SQL Server datatype that actually has nothing to do with dates or times, and is actually a ROWVERSION.
You probably want a column that holds the DATETIME that a row was added or changed. You can get the current time from the GETDATE() or GETUTCDATE() functions, and store it in the table using a procedure, default, or trigger, depending on your actual requirements.
October 27, 2012 at 10:49 am
thanks for clarification, what i need is once is get data from file, i need to store what date and time it came
in my sql server table.
do i need to create 2 field ,one has date another has time.
October 27, 2012 at 2:51 pm
harri.reddy (10/27/2012)
thanks for clarification, what i need is once is get data from file, i need to store what date and time it camein my sql server table.
do i need to create 2 field ,one has date another has time.
No, one column is enough - declare it as type DATETIME2, and use sysdatetime() to get the value to put into it.
Tom
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply