Our Informix server is struggling with all the reports we run and so we are thinking of making a dedicated server for reporting.
SQL is an obvious choice because we have it already for our retail system.
However, the challenge is how to download the data we need each night. DTS works a treat but it is the volume of data that is the problem.
We are a retail operation and we need to download the transactions from our Informix server into SQL. This data gets into Informix from the EPOS system in our stores.
What we don't want to do is download everynight the entire back history of transactions. We could do this by using the date of the transactions but we discovered it wont work.
The problem is that if a store doesn't post their transactions e.g. because of a system failure then these will get missed.
What we need to do is record which transactions are downloaded into SQL and then compare this against what is on the Informix server and then download the difference each night.
We thought of adding a flag onto the Informix server but we are not able to make any modifications to it.
I think we could log the downloaded transactions in a SQL table and then use this as a record of what has been downloaded. We could then run a query that compares this to what is on the Informix server.
With the right indexes I think this could work really well. Any thoughts? Incidently the two servers are separated by a 512Kbps wan link.....Hmmmm!
DTS is very robust. Using an activex script transformation you can pretty much order and amend the data as you see fit, including the decision of which transacts to load or just skip over because you've already loaded it.
Howevere it's generally better to limit what you pull in. I am geussing your transactions are timestamped in some way?. You can adjust the the SQL in the transform task dynamically using a parameter whihc reads its value out of a global variable.
You can set the global variable dynamically using a piece of script. This will limit the data pulled through and should prevent you needing to figure out whihc data is duplicated and which isn't.
You could run the DTS multiple times, once for each store using a different parameter to restrict your data selection to just the current store.
If a store fails to import or returns 0 records to import you could always re-run that store later either manually or programtically.
Timothy Peterson has an excellent book out about DTS programming whihc covers this stuff in a far more approcahable manner than the Books Online docs.
Originally posted by FunkyD
Our Informix server is struggling with all the reports we run and so we are thinking of making a dedicated server for reporting.
SQL is an obvious choice because we have it already for our retail system.
However, the challenge is how to download the data we need each night. DTS works a treat but it is the volume of data that is the problem.
We are a retail operation and we need to download the transactions from our Informix server into SQL. This data gets into Informix from the EPOS system in our stores.
What we don't want to do is download everynight the entire back history of transactions. We could do this by using the date of the transactions but we discovered it wont work.
The problem is that if a store doesn't post their transactions e.g. because of a system failure then these will get missed.
What we need to do is record which transactions are downloaded into SQL and then compare this against what is on the Informix server and then download the difference each night.
We thought of adding a flag onto the Informix server but we are not able to make any modifications to it.
I think we could log the downloaded transactions in a SQL table and then use this as a record of what has been downloaded. We could then run a query that compares this to what is on the Informix server.
With the right indexes I think this could work really well. Any thoughts? Incidently the two servers are separated by a 512Kbps wan link.....
Showing posts with label obvious. Show all posts
Showing posts with label obvious. Show all posts
Monday, March 19, 2012
Sunday, March 11, 2012
Calling a stored proc/UDF with results from another
Hi all - I'm sure this is a silly, obvious question, but I'm having some
trouble..
Let's say I have three tables: Events, People and EventsPeople.
EventsPeople is a join-table that represents the people associated with each
event.
I have a GetPerson stored procedure that takes a personId as a parameter and
returns the record for that person. I'm trying to reuse this logic from a
GetPeopleInEvent stored procedure, and I'm not sure how to do this w/o a
cursor:
I'm trying to do this:
select * from people
where personId in
(select personId
from eventspeople
where eventId = @.eventId)
But I want to get rid of the 'select * from people* part and replace it with
something like this:
select *
from Func_Person_GetPerson(personId)
where personId in
(select personId
from eventspeople
where eventId = @.eventId)
where Func_Person_GetPerson is a user-defined function. This, of course,
doesn't work - the parameter 'personId' isn't defined in the FROM clause.
Any ideas on the best way to do this?
Thanks,
PhilWhy not
SELECT p.[Name] FROM People p
INNER JOIN EventsPeople e ON e.PersonID = p.PersonId
WHERE e.eventID = @.eventId
assuming you have a [Name] column in People that stores the full name of the
person. Whatever statements you use in your sp to retreive the name for a
given PersonID, put them in the above to get the name directly in one query,
instead of using a udf.
Also think about using joins instead of sub-queries and the IN clause; you
will likely see much better performance in your queries.
"PMarino" wrote:
> Hi all - I'm sure this is a silly, obvious question, but I'm having some
> trouble..
> Let's say I have three tables: Events, People and EventsPeople.
> EventsPeople is a join-table that represents the people associated with ea
ch
> event.
> I have a GetPerson stored procedure that takes a personId as a parameter a
nd
> returns the record for that person. I'm trying to reuse this logic from a
> GetPeopleInEvent stored procedure, and I'm not sure how to do this w/o a
> cursor:
> I'm trying to do this:
> select * from people
> where personId in
> (select personId
> from eventspeople
> where eventId = @.eventId)
> But I want to get rid of the 'select * from people* part and replace it wi
th
> something like this:
>
> select *
> from Func_Person_GetPerson(personId)
> where personId in
> (select personId
> from eventspeople
> where eventId = @.eventId)
> where Func_Person_GetPerson is a user-defined function. This, of course,
> doesn't work - the parameter 'personId' isn't defined in the FROM clause.
> Any ideas on the best way to do this?
>
> Thanks,
> Phil
>|||I like it the way you didi it before Whats wrong with this for you ?
Like you mentioned a table function based on a column in the resultset
won=B4t work.
HTH, Jens Suessmeyer.|||As usual, I didn't give ALL of the information ;-)
I actually have several tables with join tables to People. Plus, the People
table has additional attributes - Names, PhoneNumbers, etc. I was trying to
centralize the 'GetPerson' logic, but it doesn't look like I'll be able to d
o
that easily.
"Jens" wrote:
> I like it the way you didi it before Whats wrong with this for you ?
> Like you mentioned a table function based on a column in the resultset
> won′t work.
> HTH, Jens Suessmeyer.
>
trouble..
Let's say I have three tables: Events, People and EventsPeople.
EventsPeople is a join-table that represents the people associated with each
event.
I have a GetPerson stored procedure that takes a personId as a parameter and
returns the record for that person. I'm trying to reuse this logic from a
GetPeopleInEvent stored procedure, and I'm not sure how to do this w/o a
cursor:
I'm trying to do this:
select * from people
where personId in
(select personId
from eventspeople
where eventId = @.eventId)
But I want to get rid of the 'select * from people* part and replace it with
something like this:
select *
from Func_Person_GetPerson(personId)
where personId in
(select personId
from eventspeople
where eventId = @.eventId)
where Func_Person_GetPerson is a user-defined function. This, of course,
doesn't work - the parameter 'personId' isn't defined in the FROM clause.
Any ideas on the best way to do this?
Thanks,
PhilWhy not
SELECT p.[Name] FROM People p
INNER JOIN EventsPeople e ON e.PersonID = p.PersonId
WHERE e.eventID = @.eventId
assuming you have a [Name] column in People that stores the full name of the
person. Whatever statements you use in your sp to retreive the name for a
given PersonID, put them in the above to get the name directly in one query,
instead of using a udf.
Also think about using joins instead of sub-queries and the IN clause; you
will likely see much better performance in your queries.
"PMarino" wrote:
> Hi all - I'm sure this is a silly, obvious question, but I'm having some
> trouble..
> Let's say I have three tables: Events, People and EventsPeople.
> EventsPeople is a join-table that represents the people associated with ea
ch
> event.
> I have a GetPerson stored procedure that takes a personId as a parameter a
nd
> returns the record for that person. I'm trying to reuse this logic from a
> GetPeopleInEvent stored procedure, and I'm not sure how to do this w/o a
> cursor:
> I'm trying to do this:
> select * from people
> where personId in
> (select personId
> from eventspeople
> where eventId = @.eventId)
> But I want to get rid of the 'select * from people* part and replace it wi
th
> something like this:
>
> select *
> from Func_Person_GetPerson(personId)
> where personId in
> (select personId
> from eventspeople
> where eventId = @.eventId)
> where Func_Person_GetPerson is a user-defined function. This, of course,
> doesn't work - the parameter 'personId' isn't defined in the FROM clause.
> Any ideas on the best way to do this?
>
> Thanks,
> Phil
>|||I like it the way you didi it before Whats wrong with this for you ?
Like you mentioned a table function based on a column in the resultset
won=B4t work.
HTH, Jens Suessmeyer.|||As usual, I didn't give ALL of the information ;-)
I actually have several tables with join tables to People. Plus, the People
table has additional attributes - Names, PhoneNumbers, etc. I was trying to
centralize the 'GetPerson' logic, but it doesn't look like I'll be able to d
o
that easily.
"Jens" wrote:
> I like it the way you didi it before Whats wrong with this for you ?
> Like you mentioned a table function based on a column in the resultset
> won′t work.
> HTH, Jens Suessmeyer.
>
Sunday, February 19, 2012
calculation values
Hi all,
I had posted a problem,and I didn't get the obvious solution, can you help me please:
My table looks like the following:
Date\Time Counter1 Counter2
The counters are taken by an automatic system in three shifts:
First in : 6:00 AM Second in: 15:00 PM Third in : 11:00 PM
I want a query to calculate the difference of the counters between the three shifts (Let's begin with this).
For example: The following table
22/11/04 11:00 PM 0 0
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 20 30
23/11/04 23:00 PM 30 40
The output is:
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 10 10
23/11/04 11:00 PM 10 10
I'm new I the SQL world. can you please help me and give me sum information to solve the problem.the answer is here -- http://www.dbforums.com/t1063139.html|||But, the answer isn't sufficient to my problem.
thanks...|||then you will have to ask your question a bit more clearly
maybe we do not understand the problem|||I'll explain secondly,
my really table is the following:
1. CollectDate (Date/Time): The date and time of collecting data.
2. MachineNum (Number): The machine number of the data. I have 40...50 machines.
3. WorkOrder (Number): A number witch discribe the part of the machine.
4. TotalGood (Number): An accumulator of the current parts that the machine did.
The total task of the query is to calculate how many parts did the machine do in a certain date but by shifts.
E.g:
the final date collection was:
CollectDate MachineNum WorkOrder TotalGood
25/11/04 23:00:00 40 00111 100
26/11/04 6:00:00 40 00111 200
26/11/04 15:00:00 40 00111 500
26/11/04 23:00:00 40 00111 1000
The query output is:
Shifts(26/11/04) MachineNum WorkOrder TotalGood
6:00:00 40 0011 100 (200-100)
15:00:00 40 0011 300 (500-200)
23:00:00 40 0011 500 (1000-500)
Please help me.
Best regards...
I had posted a problem,and I didn't get the obvious solution, can you help me please:
My table looks like the following:
Date\Time Counter1 Counter2
The counters are taken by an automatic system in three shifts:
First in : 6:00 AM Second in: 15:00 PM Third in : 11:00 PM
I want a query to calculate the difference of the counters between the three shifts (Let's begin with this).
For example: The following table
22/11/04 11:00 PM 0 0
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 20 30
23/11/04 23:00 PM 30 40
The output is:
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 10 10
23/11/04 11:00 PM 10 10
I'm new I the SQL world. can you please help me and give me sum information to solve the problem.the answer is here -- http://www.dbforums.com/t1063139.html|||But, the answer isn't sufficient to my problem.
thanks...|||then you will have to ask your question a bit more clearly
maybe we do not understand the problem|||I'll explain secondly,
my really table is the following:
1. CollectDate (Date/Time): The date and time of collecting data.
2. MachineNum (Number): The machine number of the data. I have 40...50 machines.
3. WorkOrder (Number): A number witch discribe the part of the machine.
4. TotalGood (Number): An accumulator of the current parts that the machine did.
The total task of the query is to calculate how many parts did the machine do in a certain date but by shifts.
E.g:
the final date collection was:
CollectDate MachineNum WorkOrder TotalGood
25/11/04 23:00:00 40 00111 100
26/11/04 6:00:00 40 00111 200
26/11/04 15:00:00 40 00111 500
26/11/04 23:00:00 40 00111 1000
The query output is:
Shifts(26/11/04) MachineNum WorkOrder TotalGood
6:00:00 40 0011 100 (200-100)
15:00:00 40 0011 300 (500-200)
23:00:00 40 0011 500 (1000-500)
Please help me.
Best regards...
Subscribe to:
Posts (Atom)