473,806 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newb question about sql+ script for appending to end of table

8 New Member
Is there a statement that will allow appending to the end of table when inserting new data? I use multiple "insert into table1(timestam p1,area1,value1 ,value2...)" to insert different area data with the same timestamp into the same table. When I look at the data in the table sometimes the rows are placed randomly into the table. When I queue a php script to display the data for a particular day the order changes because the order in the table changes. I know there are ways to correct this when pulling the data from the oracle table but I am no PHP expert. This code was written by someone else and for me to change it may cause more harm than good. I can add a column and a qualifier (areanumber) to order them that way in the php file but thought if there was a way to add the data to the bottom which would keep them in the same order, I hope, or even some way of keeping the inserted rows order the same it would solve my issue. I hope this is clear enough. Thanks for your help.
Jul 9 '09 #1
9 3143
amitpatel66
2,367 Recognized Expert Top Contributor
You can use ORDER BY ROWID to order the data in ascending order in which the data is inserted in the table.
Jul 9 '09 #2
JWM81274
8 New Member
@amitpatel66
It appears as though it is the ROWID that is out of order. I looked at the ROWIDs and for some reason the first insert statement is getting an ID that is not in order with the rest. Sometimes the ID is an earlier one sometimes it is a later one. Here is the script I am using, shortened for display:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO "TABLE1" (DATE1, SHOPS, KILN_DAY, DAY_OF_YEAR)
  2. VALUES (LOCAL.DATE1, 'COAL',"HISTORIAN DATA",LOCAL.DAYOFTHEYEAR);
  3.  
  4. INSERT INTO "TABLE1" (DATE1, SHOPS, KILN_DAY, DAY_OF_YEAR)
  5. VALUES (LOCAL.DATE1, 'COAL BTU',"HISTORIAN DATA",LOCAL.DAYOFTHEYEAR);
  6.  
  7. INSERT INTO "TABLE1" (DATE1, SHOPS, KILN_DAY, DAY_OF_YEAR)
  8. VALUES (LOCAL.DATE1, 'COAL BTU/TON',"HISTORIAN DATA",LOCAL.DAYOFTHEYEAR);
  9.  
This code is written in SQL+ but it is a version used by the historian "Aspen IP21" not Oracle. We were unable to get the link set up so I am pushing the data to Oracle rather than pulling it. The Historian data is a select statment to pull unique data for that shop. Hope this sheds more light on my issue.

Thanks again for the help.
Jul 10 '09 #3
asp2
10 New Member
according to my search results ,

if the SELECT statement does not have a specific ORDER BY , then there's no way you can determine exactly in which order data will come .


try it yourself on any table and select from that table once witout an order by , and else with order by rowid , and you will see yourslelf ..

the best way is to add an order by in the program you are using

you can at least order by ROWID
Jul 10 '09 #4
JWM81274
8 New Member
I just added a column to all the tables that I placed an numeric value and ordered by that column. ROWID didn't work because the order created is not the same as when you order by ROWID. The ID created uses + ,\ , "A", "a", and #'s 0-9 in the ID that order. When you order by ROWID ASC the + is at the top then the \, followed by 0 through 9, then "A" and lastly "a". If the ROWID of the values crosses from letters to numbers the order will be wrong.
Jul 13 '09 #5
amitpatel66
2,367 Recognized Expert Top Contributor
Are you looking at orderding the data based on the ASCII value of each rows data for a particular column?..When you use ROWID, it will order the records based on when the record is inserted in the table. in ASC order, records inserted latest will be listed at last.
Jul 13 '09 #6
JWM81274
8 New Member
I am trying to order by inserted in the table. ROWID ASC(ascending order) doesn't match when it was inserted. I tested with inserting 9 rows at one timestamp 10 times and when sorted by ROWID ASC(ascending order) the timestamp rows don't always allign. I don't understand why exactly. It maybe the ASPEN IP21 version of SQL+.

I did fix my issue another way though.
Jul 13 '09 #7
JWM81274
8 New Member
Thanks for all the help.
Jul 13 '09 #8
amitpatel66
2,367 Recognized Expert Top Contributor
Good to hear that your issue is resolved. It would be great if you can post the solution of how did you solve your problem so that in case any other user faces similar issue they can refer to this thread for help.
Jul 14 '09 #9
JWM81274
8 New Member
To fix my issue I added another column called "order1" to all the oracle tables I am using. When the data was pushed into oracle I also pushed the order I wanted displayed on the PHP page into the column "order1". In the script for PHP I used order by "order1" asc. Which ordered the data correctly. Thanks again for the help.
Jul 14 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2133
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No Preference", I'd like to uncheck
5
2040
by: Alexandre | last post by:
Hi, Im a newb to dev and python... my first sefl assigned mission was to read a pickled file containing a list with DB like data and convert this to MySQL... So i wrote my first module which reads this pickled file and writes an XML file with list of tables and fields (... next step will the module who creates the tables according to details found in the XML file). If anyone has some minutes to spare, suggestions and comments would be...
6
34183
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of the relevant infomation, in a binary format. SQL Enterprise manager offers no way to script out those diagrams, so I have created two Transact SQL components, one User Function and one User Procedure, which together provide a means to script...
3
1834
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No Preference", I'd like to uncheck
10
6569
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along with SQL. I'd like to take the name of the column and input it into a descritor field. This isn't the table, but will serve as a better illustration than the real deal. If the table looks like this:
1
4484
by: JoeBobHankey | last post by:
Background: - I'm running MSDE 2000 (not client tools, stored procedure capability, etc). This may change, but not in the first part of development. - My Access file is an Access 2002 project (.adp project client connecting directly to MSDE SQL database - no .mdb involved or local file tables beyond the .dbfs to be imported). - Using ODBC to connect to .dbf data sources without a problem (ODBC is
4
1623
by: Pete Horm | last post by:
Hi everyone, I have a question about using this variable. I am new to programming and I had a book that was a couple of years old regarding php programming. None of the examples were working correctly, until I discovered that my new version of PHP 4.4 disabled global variables. I figured out how to make the following php script work correctly, but I don't know if the way I made it work is the accepted way of doing things with $_POST. I...
29
2667
by: jaysherby | last post by:
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can someone set me on the right path to what modules and calls to use to do that? You'd think that it would be a fairly simple proposition, but I can't find examples anywhere. Thanks.
1
11536
by: Cragu | last post by:
Hi Gurus, I'm trying to extract the data from DB2 datas. I used DB2CMD to connect from the CMD prompt from there I'm running a batch file. In that batch file, I will connect to the database and run the sql query. Im using
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.