Formatting Data in Tabular Form

I use SQL 6.5 in an industrial setting. I have an application that writes a new record into the database every time a pallet blocks a photoswitch. After 24 hours I run a report that tells me how many pallets have blocked that switch every 15-minute period.

The query looks like this:

 /* Count into ASRS 15 minute intervals from d1=12:15AM-11:15PM */USE AlarmSuiteGO--************************************************************************--*              12 HOUR PERIOD BEGINNING AT 12 MIDNIGHT                 *--************************************************************************Print '9/29/99 12:00 AM TO 12:15 AM'SELECT Count(*) FROM AlarmLogWHERE TagName = 'sqlb920.ack'AND EventStamp >= '9/29/99 12:01 AM'AND EventStamp <= '9/29/99 12:15 AM' Print '9/29/99 12:15 AM TO 12:30 AM'SELECT Count(*) FROM AlarmLogWHERE TagName = 'sqlb920.ack'AND EventStamp >= '9/29/99 12:15 AM'AND EventStamp <= '9/29/99 12:30 AM'

My problem is that the results are formatted sequentially:

 '9/29/99 12:15 AM TO 12:30 AM'---------35 rows selected'9/30/99 12:30 AM TO 12:45 AM'---------45 rows selected

and so on. How can I write this query such that it will be formatted in tabular form, like this?

 12:15AM     3512:30AM     4512:45AM     381:00AM      55...

I tried to use Microsoft Query and Access to make the query but the disk starts spinning like crazy and bogging down all the other on-going queries in the process.

This data collection effort, in addition to real alarm logging, adds about 100MB to the database every week.

If you create a temp table and wrap your select in a cursor, you can update the temp table with the counts for the time periods of the selects.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS