views:

333

answers:

1

I am trying to copy data from my MYSQL table to SQL Server using PHP.

I have a TimeStamp value that needs to be copied. While I am trying to copy the fields, it gave an error that timestamp value cannot be inserted. Is there any way to insert the timestamp value?

Is it is not possible, then declaring the column as nvarchar will insert the timestamp, but will I be able to search the data in a date range?

Can anyone please clarify my doubt?

Thanks.

+4  A: 

SQL Server's TIMESTAMP date type has nothing to do with a date or a time - it's just a binary counter which is guaranteed to always increment over time, when a row is updated. It's used for concurrency checks.

The name is unfortunate - but it's really just a system-indicator. You cannot set or insert a value into such a column - those are handled strictly by SQL Server itself.

For Date/Time, used DATETIME or SMALLDATETIME in SQL Server up to 2005, and SQL Server 2008 also offer additional types like DATE, TIME, DATETIMEOFFSET (with timezone info) and so on.

marc_s
so can i use any other datatype for storing my timestamp? will I be able to perform date range searches on that then?
JPro
I wish I could upvote twice. I've always wondered why TIMESTAMP was so screwy.
Syntax Error