Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Not correct order

Status
Not open for further replies.

gustaf111

Programmer
Jan 16, 2011
87
SE
Hello,

I have a problem that the order that I write to the database is not the same order when I look at the database in SQL Server Management Studio. It looks like:

ID Time Date Larm
3 21:29:42 2011-02-13 Larm3
5 21:29:59 2011-02-13 Larm5
7 21:30:07 2011-02-13 Larm7
9 21:30:09 2011-02-13 Larm9
1 21:29:41 2011-02-13 Larm1
2 21:29:41 2011-02-13 Larm2
4 21:29:43 2011-02-13 Larm4
6 21:30:07 2011-02-13 Larm6
8 21:30:08 2011-02-13 Larm8

I write in the to the database in ID order så I would expect:
ID
1
2
etc

I loop when I write to the database, are there a possibility that the previous "objCommandEvent.Execute" is not finnished ? If how do I wait unitil finnished ?

I use Microsoft SQL Server 2008

Please help!! Gustaf
 
SQL Management Studio not necessarily shows records in ID or in chronological order. So everything is ok.

Bye, Olaf.
 
Hello Olaf,

Thanks for you answer! I would like to read the data in the same order I wrote them down. (I wrote them down in ID order)

I will read the data in the same order I see in SQL Management Studio, which in not what I want :(

Gustaf
 
And now I get this .... Is it some real time problem when I access the database ?

ID Time
46 23:31:25 2011-02-13 Larm46
52 23:31:45 2011-02-13 Larm52
32 23:30:39 2011-02-13 Larm32
37 23:30:59 2011-02-13 Larm37
1 23:28:55 2011-02-13 Larm1
2 23:28:57 2011-02-13 Larm2
3 23:28:59 2011-02-13 Larm3
4 23:29:01 2011-02-13 Larm4
5 23:29:03 2011-02-13 Larm5
6 23:29:11 2011-02-13 Larm6
7 23:29:13 2011-02-13 Larm7
8 23:29:15 2011-02-13 Larm8

etc...
 
Hello Markros!! Thanks!!!

If I want to sort by date and time, I write ORDER BY, Time, Date ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top