First of all the requirement is to not have to use Order by when viewing the raw data.
"Select * from tablename" should show them in order as mentioned below.
The table the records are from is sorted correctly by Date Descending and Time Descending. However when doing an insert the records get out of order. I tried adding an Order by in the insert clause but this is not allowed the way I am doing it(see blue code).
ANY help would be appreciated, suggestions ideas or whatever, for constraints or indexes prior to importing; since this is on going? In testing the records were deleted and now I am having trouble getting them back in correctly. I managed to do it once but the notes I had were deleted. I tried adding an index but this did not index them properly by date and time it just left them out of order. Adding the blue script gives error: Expecting ')', EXCEPT or UNION.
DougP
"Select * from tablename" should show them in order as mentioned below.
The table the records are from is sorted correctly by Date Descending and Time Descending. However when doing an insert the records get out of order. I tried adding an Order by in the insert clause but this is not allowed the way I am doing it(see blue code).
ANY help would be appreciated, suggestions ideas or whatever, for constraints or indexes prior to importing; since this is on going? In testing the records were deleted and now I am having trouble getting them back in correctly. I managed to do it once but the notes I had were deleted. I tried adding an index but this did not index them properly by date and time it just left them out of order. Adding the blue script gives error: Expecting ')', EXCEPT or UNION.
Code:
Insert into [dbo].[HistData]
([Ticker], [BarSize],[HD_Date],[HD_Time],[HD_Open],
[HD_High],[HD_Low],[HD_Close],[Stock_Volume])
(Select 'ES', '5 mins', CONVERT(date,[HD_Date],101), CONVERT(time,[HD_Time],108),[HD_Open],
[HD_High],[HD_low],[HD_close],0
from [dbo].[Emini5$] [COLOR=blue]Order by HD_Date DESC, [HD_Time] DESC[/color])
DougP