473,320 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

wrong select or insert into ?

hello

I have strange problem.
I write to MySQL data to table with one column of varchar(8000). I write
750000 bytes, so it get 93 records of 8000 bytes and the last - 6000bytes.
but what is strange - when I check length of this records:

select len(column_name) from table_name

this last record ( which is 6000bytes length ) isn't on 94 position, but ...
on 14 position !?
The same, when I try to reads recods:

select column name from table name

this 6000 record apear on 14 position instead on 94 position

It's important to me to get this record on proper ( last) position to not
change ( complicating ) my C++ application algoritm.

Could someone help me, please

thanks in advance

Adam

Aug 22 '05 #1
4 1651
>> It's important to me to get this record [sic] on proper (last) position [sic] to not change (complicating ) my C++ application algoritm. <<

You never had a class or read a book on RDBMS, have you? The most
fundamental concept in SQL is that there is no ordering to table!!

Let's get back to the basics of an RDBMS. Rows are not records; fields
are not columns; tables are not files; there is no sequential access or
ordering in an RDBMS, so "first", "next" and "last" are totally
meaningless. If you want to have an ordering, you need a column for it.

Aug 22 '05 #2
Yes- you are right. I did it - I added a field ( lp int ) with integer from
1 to last row - and added to my question "order by lp"- there I get what I
want.
But there is some interesting - you say that there is no any ordering in
RDBMS. So why I always get this row at 14 posiotion? There must be some
"internal" ordering if SQL give me this row ALWAYS on 14 position - not on
random position ( first time on 14 , next on 20 and so on ).

best wishes

Adam

Aug 23 '05 #3
Without an "order by" clause in your query, you're likely to get the
rows out ordered by the clustered index, since that's the order that
they're stored on the disk. That's probably why you're getting them in
the same order everytime.

BTW, before you chime in, Celko, I don't give two shits that "order by"
is part of a cursor, not a query -- so save your breath.

Aug 23 '05 #4
Without ORDER BY, SQL Server is free to return results in any sequence.
This is usually the most efficient chosen by the cost-based optimizer.
Ordering of results may vary depending on indexes, statistics, number of
processors, concurrent queries, etc. The version, service pack, and hotfix
level can also influence ordering due to potential optimizer changes.
Consequently, one should never assume data will be returned in any
particular order unless ORDER BY is specified.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"adam" <er******@wp.pl> wrote in message
news:de**********@nemesis.news.tpi.pl...
Yes- you are right. I did it - I added a field ( lp int ) with integer
from
1 to last row - and added to my question "order by lp"- there I get what I
want.
But there is some interesting - you say that there is no any ordering in
RDBMS. So why I always get this row at 14 posiotion? There must be some
"internal" ordering if SQL give me this row ALWAYS on 14 position - not on
random position ( first time on 14 , next on 20 and so on ).

best wishes

Adam

Aug 24 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
Im getting way too many rows retured..what its trying to do is insert a 0 for revenue for months 7 - 12 (aka July through December) for each of these cost centers for each payor type..Im getting a...
3
by: Matik | last post by:
Hello all, I belive, my problem is probably very easy to solve, but still, I cannot find solution: declare @i int declare @z int create table bubusilala (
4
by: pgp.coppens | last post by:
All, Seeing the behaviour below on DB2 v8 on zOS create table test(intcol integer); insert into test values (1); insert into test values (2); insert into test values (3); insert into test...
4
by: Hyphessobrycon | last post by:
Private Sub btnrubriekbij_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrubriekbij.Click 'insert hier Dim cn As New OleDb.OleDbConnection(constr) Dim dc As...
4
by: Jeff Boes | last post by:
(I thought I posted this yesterday from Google Groups, but it doesn't appear to have "taken".) I'm having a problem with a rule designed to log new rows inserted into one table. The base table...
3
by: Peter | last post by:
Hello all, I have the following t-sql batch: create procedure stp_test ( @p_date1 as datetime = null, @p_date2 as datetime = null )
0
by: jeffmagill | last post by:
Hi Everybody, I'm really hoping that someone can help me out because I have spent too much time on this project already! Basically, I have a DetailsView that handles all the Edits for a...
2
by: babayaro | last post by:
when i am tryin to execute this file...the error below displayed..pls help me ERROR at line 29: ORA-06550: line 29, column 6: PLS-00306: wrong number or types of arguments in call to...
16
by: SLIMSHIM | last post by:
Hi, I"m new to c# and .net. I wrote a small program to add rows to an access table. the program goes thru the motions but the data never gets there. here is my code. I am intentionaly not using...
2
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.