In which order does a SQL Replication write the data I use a unidirectional Replication of a database.
In the Database I have a column with the datatype &quot;timestamp&quot; (not datetime).
When the replication is initiated it writes table after table to the subscriber.
My question is: Is the data within a table writen to the subscriber in the same order as it was created in the published database?
So is the timestamp in a table of the subscriber also usable as a sort order as it was on the publisher e.g. for last inserted and updated records? Becouse unfortunatly I do not have a column like EditDateTime.
I'm not sure if you mean Transactional Replication or Snapshot Replication in your current situation, but in either case the ordering of the data should be preserved. You can read more on how Transactional Replication works in that linked Brent Ozar article.
Transactional Replication uses the the Transaction Log to ensure Atomicity and Consistency of the ACID principals in SQL Server. Snapshot Replication is a literal copy (snapshot) of your data in a point in time and exactly preserved that way when distributed to the Subscriber database.
That being said, the data type TIMESTAMP is uniquely generated based on the rowversion by the server and therefore will not match between your Publisher and Subscriber database(s).
For Transactional Replication it should be in the same sequential ordering, for Snapshot Replication I don't know if it can be guaranteed and you'd have to test, but my guess is there's still a consistent row ordering by the underlying rowid of the table, if not the primary key, and therefore should also be consistent (despite being new values in the TIMESTAMP field.)