Skip to main content
Solved

SQLExecutor disrupts uniqueidentifier order? how to maintain it?

  • April 23, 2017
  • 1 reply
  • 7 views

I've got a table in sqlserver with an id column with unique identifier type and default value newsequentialid(). I need to reference these keys from another table so i need to exactly move this column as FK to another table but when i use SQLExecutor() with query 'select id from table' to write these attribute the order of GUID's get disruted and does not maintain its original order? Is it possible to maintain its order?

Best answer by takashi

Hi @dzhakob, generally you cannot expect any regularity on the order of records in a query result unless you specify the order explicitly with the SQL statement. Consider adding ORDER BY clause to the SQL statement if you need to sort the resulting records.

View original
Did this help you find an answer to your question?

1 reply

takashi
Evangelist
  • Best Answer
  • April 23, 2017

Hi @dzhakob, generally you cannot expect any regularity on the order of records in a query result unless you specify the order explicitly with the SQL statement. Consider adding ORDER BY clause to the SQL statement if you need to sort the resulting records.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings