Hello,
Can I have some advise on how to do the following.
I need to create a csv file based on a query of new records from a table. In
other words the query will run periodically and I dont want it to pick up
the records that were already queried.
ThanksSorry Wont way to put it.
I need to insert not update...
"Al" wrote:
> Hello,
> Can I have some advise on how to do the following.
> I need to create a csv file based on a query of new records from a table. In
> other words the query will run periodically and I dont want it to pick up
> the records that were already queried.
> Thanks|||Several ways you can do this, but might require some schema changes on your
part. If you have a DATETIME column, you can use that to determine which
ones are new and which aren't. You could add a CHAR(1) column to indicate
if a row has been queried already or not (you would need to change the value
after the query to indicate that it's been queried). If you have some sort
of incremental key, such as an IDENTITY column you can store the highest
value for that column at query time and the next time you query just grab
any rows with a higher value in that column.
Basically you'll have to store some sort of "state" value so your app will
know where it left off the last time it ran.
"Al" <Al@.discussions.microsoft.com> wrote in message
news:EB5EFD0D-8C92-4EFB-B6F2-1D041113852D@.microsoft.com...
> Sorry Wont way to put it.
> I need to insert not update...
> "Al" wrote:
>> Hello,
>> Can I have some advise on how to do the following.
>> I need to create a csv file based on a query of new records from a table.
>> In
>> other words the query will run periodically and I dont want it to pick
>> up
>> the records that were already queried.
>> Thanks|||Use some timestamp column..
Jayesh
"Al" <Al@.discussions.microsoft.com> wrote in message
news:FD248A9C-EB29-407A-ACF2-6D811BE73E66@.microsoft.com...
> Hello,
> Can I have some advise on how to do the following.
> I need to create a csv file based on a query of new records from a table.
> In
> other words the query will run periodically and I dont want it to pick up
> the records that were already queried.
> Thanks|||You still need to store the highest timestamp used for the last batch
somewhere...
"Jayesh Antony Jose" <jayeshaj@.hotmail.com> wrote in message
news:%239FsEdDjGHA.4304@.TK2MSFTNGP03.phx.gbl...
> Use some timestamp column..
> Jayesh
> "Al" <Al@.discussions.microsoft.com> wrote in message
> news:FD248A9C-EB29-407A-ACF2-6D811BE73E66@.microsoft.com...
>> Hello,
>> Can I have some advise on how to do the following.
>> I need to create a csv file based on a query of new records from a table.
>> In
>> other words the query will run periodically and I dont want it to pick
>> up
>> the records that were already queried.
>> Thanks
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment