Friday, February 24, 2012

Design Question!

Hi,
i need some advice on the best way to do something; here the explaination
i have a request from the powers above me to design a solution that will do
the following
from telecom CDR (Call Data Records); record the following the destination
telephone number, date and if it was evening, daytime or wend into a
different table. if that number already exists update the date to the
current date and update the counters of "evening , daytime or wend".
the average size of the input file is around 2 million plus. My question
is; that i have 2 possible solutions but i am unsure of the right one to use
1, use a function within a cursor
2. use a trigger
my thoughts are that idea 1 will be very resource hungry but am sure about
the use of a trigger as the data could be either updated or inserted. can
somebody please point me in the right direction?
and i hope this makes sense
Many thanks
Simon WhaleWhy do you need to use a trigger or a cursor? You should be able to use
BCP, DTS (or SSIS if 2005) or Bulk Insert to bulk load the file into a
staging table. From there you can use SET based processing to update the
other tables. You probably want to do the updates in smaller batches of say
10K at a time to minimize blocking etc.
Andrew J. Kelly SQL MVP
"Simon Whale" <s.whale@.nospam.dsl.pipex.com> wrote in message
news:usZf%23HvcGHA.1260@.TK2MSFTNGP05.phx.gbl...
> Hi,
> i need some advice on the best way to do something; here the explaination
> i have a request from the powers above me to design a solution that will
> do the following
> from telecom CDR (Call Data Records); record the following the destination
> telephone number, date and if it was evening, daytime or wend into a
> different table. if that number already exists update the date to the
> current date and update the counters of "evening , daytime or wend".
> the average size of the input file is around 2 million plus. My question
> is; that i have 2 possible solutions but i am unsure of the right one to
> use
> 1, use a function within a cursor
> 2. use a trigger
> my thoughts are that idea 1 will be very resource hungry but am sure about
> the use of a trigger as the data could be either updated or inserted.
> can somebody please point me in the right direction?
> and i hope this makes sense
> Many thanks
> Simon Whale
>

No comments:

Post a Comment