job for collecting data

  • I need a script to copy data from one table(source) to anotehr table (destination),

    i want to sheduling this task for every 5 minute , rows which data were copied before don't copy again.

  • eh.shams (9/17/2012)


    I need a script to copy data from one table(source) to anotehr table (destination),

    i want to sheduling this task for every 5 minute , rows which data were copied before don't copy again.

    What columns/data do you ahve to detect what are new rows? What's the table look like? what tools do you have available? SQLAgent, SSIS, what is available?


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • source table is like this one :

    Customer Code|cslAccumulationInvoiceItmId|cslAccumulationInvoiceRef|cslDeliveryNoteRef|cslProductRef|Amount|RateCurrencyRate|price beforePriceInBaseCurrency|Deliver No|Date-Reci

    4005604666346644285322121.54504807110873542.7810873542.78171691/10/2012 00:00

    4005604665946644284882122.86504807111539888.0211539888.02171461/10/2012 00:00

    4005603641436413192044717.6651923019169601.89169601.81095611/30/2011 00:00

    4005603530535304181764724.12519230112523827.612523827.61036111/27/2011 00:00

    4005609649096488846394722.2656800011264368012643680270828/8/2012 00:00

    4005603531235304184654722.7519230111786521117865211054911/28/2011 00:00

    ______________________________________________

    on the destination i have same table , with only add status (bit) column.

    i want to reade from destination and if the status is false , send a message to customer, every 5 minute for example.

    on server i have MSSQL SERVER 2008 SP1,

    sql agent is ready to .

  • eh.shams (9/17/2012)


    source table is like this one :

    Customer Code|cslAccumulationInvoiceItmId|cslAccumulationInvoiceRef|cslDeliveryNoteRef|cslProductRef|Amount|RateCurrencyRate|price beforePriceInBaseCurrency|Deliver No|Date-Reci

    4005604666346644285322121.54504807110873542.7810873542.78171691/10/2012 00:00

    4005604665946644284882122.86504807111539888.0211539888.02171461/10/2012 00:00

    4005603641436413192044717.6651923019169601.89169601.81095611/30/2011 00:00

    4005603530535304181764724.12519230112523827.612523827.61036111/27/2011 00:00

    4005609649096488846394722.2656800011264368012643680270828/8/2012 00:00

    4005603531235304184654722.7519230111786521117865211054911/28/2011 00:00

    ______________________________________________

    on the destination i have same table , with only add status (bit) column.

    i want to reade from destination and if the status is false , send a message to customer, every 5 minute for example.

    on server i have MSSQL SERVER 2008 SP1,

    sql agent is ready to .

    As mentioned by Kraig

    What columns/data do you ahve to detect what are new rows?

    Based on that you can have UPINSERT script and schedule it as per your need.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • would you please be more specific , or let me know with example ?

    Thanks

  • eh.shams (9/17/2012)


    would you please be more specific , or let me know with example ?

    Thanks

    e.g. in Source and Destination table CustID is unique number then we can have below query to insert only new records

    INSERT INTO dest_tbl (Col1,Col2, .....)

    SELECT Col1,Col2, FROM sorce_tbl

    WHERE NOT EXISTS (SELECT CustId FROM dest_tbl )

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • thanks , how i can create job to do it ,periodicaly ?

  • eh.shams (9/17/2012)


    thanks , how i can create job to do it ,periodicaly ?

    That could be a very involved question. I suggest you look through the Stairway to SQL Server Agent series: http://www.sqlservercentral.com/stairway/72403/

    You'll probably only need to read the first 3-4 articles to do what you need to do.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Thank's

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply