Hello,
I am wondering where to do certain processing of data, I receive data
of about 5000 rows in the sql server (2005 Beta) Now after I got the
data I need to go trough the records and if that record matches some
criteria than I add a new record in an other table, than the next
records criteria are affected by the last record added in the other
table. Anyway it is not something I think I can do whitout some
programming logic.
Now my question is, where should I do this? Do I create a client
program and let that do it or should I create the same functionality in
the sql server? I understood I can now use c# there. Also will that be
supported by SQL Server Express 2005?
Any help is appriciated.
-MarkYou could use a cursor to do linear operations (row by row)...
declare yourcur cursor for
select ...
from ...
open yourcur
declare @.col1 ...
fetch next from yourcur into @.col1
while @.@.fetch_status = 0
begin
insert ...
fetch next from yourcur into @.col1
end
deallocate yourcur
I hope that gives you an idea, have a gander at books online for more
detailed information and examples.
But it will let you control on a row by row basis what the insert does, you
can have complex logic in the while loop.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
<internet.spam.mail@.gmail.com> wrote in message
news:1129721426.240935.263200@.g49g2000cwa.googlegroups.com...
> Hello,
> I am wondering where to do certain processing of data, I receive data
> of about 5000 rows in the sql server (2005 Beta) Now after I got the
> data I need to go trough the records and if that record matches some
> criteria than I add a new record in an other table, than the next
> records criteria are affected by the last record added in the other
> table. Anyway it is not something I think I can do whitout some
> programming logic.
> Now my question is, where should I do this? Do I create a client
> program and let that do it or should I create the same functionality in
> the sql server? I understood I can now use c# there. Also will that be
> supported by SQL Server Express 2005?
> Any help is appriciated.
> -Mark
>|||Best do it in the back end: two ways of doing this
1) Use Triggers to cascade updates
2)use sproc to update table by enabling a job at defined frequencies
--
Regards
R.D
--Knowledge gets doubled when shared
"internet.spam.mail@.gmail.com" wrote:
> Hello,
> I am wondering where to do certain processing of data, I receive data
> of about 5000 rows in the sql server (2005 Beta) Now after I got the
> data I need to go trough the records and if that record matches some
> criteria than I add a new record in an other table, than the next
> records criteria are affected by the last record added in the other
> table. Anyway it is not something I think I can do whitout some
> programming logic.
> Now my question is, where should I do this? Do I create a client
> program and let that do it or should I create the same functionality in
> the sql server? I understood I can now use c# there. Also will that be
> supported by SQL Server Express 2005?
> Any help is appriciated.
> -Mark
>|||Tony,
Would I be able to do tha using c#? since sql server 2005 supposed to
use that, than it can be faster, because I thought using your way is
really not that efficient.
R.D.
So when a new record is added to the first table excetute some stuff to
add or alter an record in the second database? Does that also work with
sql server express (the new msde)?
,
Thanks will look into both approcess.
-Mark
No comments:
Post a Comment