sqlwrite does not preserve row order
7 ビュー (過去 30 日間)
古いコメントを表示
I am writing a script to manipulate a .mat file containing a structure into a table and then write to a Microsoft SQL Server database. When I use the sqlwrite command, it does not seem to preserve the row order of the original table. The columns are all there and rows are written correctly, but the starting point is different every time I delete and rewrite the table. This is annoying as the data should be ordered by increasing time. Is there a way to preserve order when writing?
Thanks in advance for any help!
0 件のコメント
採用された回答
the cyclist
2023 年 3 月 9 日
Even if you store the data in a particular order (which you should not try to do), there is no guarantee that any given SELECT statement will retrieve the data in that order. I know for a fact that this is true in PostgreSQL, and I am confident that this is true in the major databases systems.
Users who need records in a particular order must use the ORDER BY clause (or equivalent).
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!