Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Transferring some data

Author  Topic 

sqlbug
Posting Yak Master

201 Posts

Posted - 2009-06-19 : 17:48:13
I am doing some data transfer where I got the following:
In SAMPLE_INFO table, Ie have 1 sample for each day. Then in the RAW_DATA table I have data for each sample#, Parameter, Method, Unit combination (for the same sample we can have several paramters). There are also 24 columns for 24 hours of data along with another 24 columns to flag (inform something about the data) - all in the same row.
I need to transfer the data into a different table structure where I have 1 sample# for each hour of the day (24 per day), then data for each sample#, Parameter, Method, Unit combination (just like before) and two more columns - one for the data itself and one for the flag (instead of 24 for 24 hours of data and 24 for flags).

Lets define them like:
SAMPLE_INFO_OLD: SAMLE_NUM, SAMPLE_TYPE, SAMPLE_STATION, SAMPLE_START_DATE,
SAMPLE_START_TIME,SAMPLE_END_DATE,SAMPLE_END_TIME
RAW_DATA_OLD: R_SAMPLE_NUM, R_PARAMETER, R_METHOD, R_UNIT,
R_DATA_H1...R_DATA_H24, R_FLAG_H1...R_FLAG_H24

SAMPLE_INFO_NEW: SAMLE_NUM, SAMPLE_TYPE, SAMPLE_STATION, SAMPLE_START_DATE,
SAMPLE_START_TIME,SAMPLE_END_DATE,SAMPLE_END_TIME (Same structure but has
24 samples for 24 hours)
RAW_DATA_NEW: R_SAMPLE_NUM, R_PARAMETER, R_METHOD, R_UNIT, R_DATA, R_FLAG.
I need help on this.
Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-20 : 01:52:26
have you heard about normalisation? why using 24 flag fields,24 data fields,... I think you should include just single flag and data field and a hour field to indicate the hour value.
Go to Top of Page
   

- Advertisement -