Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

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


Report this thread to moderator Post Follow-up to this message
Old Post
adam
08-23-05 01:23 AM


Re: wrong select or insert into ?
>> It's important to me to get this record [sic]  on proper (last) posit
ion [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.


Report this thread to moderator Post Follow-up to this message
Old Post
--CELKO--
08-23-05 01:23 AM


Re: wrong select or insert into ?
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


Report this thread to moderator Post Follow-up to this message
Old Post
adam
08-23-05 01:23 AM


Re: wrong select or insert into ?
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.


Report this thread to moderator Post Follow-up to this message
Old Post
ZeldorBlat
08-23-05 08:23 AM


Re: wrong select or insert into ?
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" <ereuseen@wp.pl> wrote in message
 news:dedop9$d60$1@ne
mesis.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
>



Report this thread to moderator Post Follow-up to this message
Old Post
Dan Guzman
08-24-05 12:24 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:28 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006