472,096 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Recursive update query

43
hi
i have a table like

col1 col2 col3 col4
35 R 0 0
36 W 1 35
37 R 0 0
38 W 2 35,36

I am giving col1 value 35 as input
i want to write a update query so that the result
col1 col2 col3 col4
35 C 0 0
36 R 0 0
37 R 0 0
38 W 1 36

pls give me any clues to write this recursive update query
Jul 16 '08 #1
3 2123
amitpatel66
2,367 Expert 2GB
You will need to write a stored proceudure for that!!
Jul 16 '08 #2
srinit
43
You will need to write a stored proceudure for that!!
Can you please tell me how can i write that procedure.
Jul 17 '08 #3
Delerna
1,134 Expert 1GB
in column 2 what do C,R,W mean?
What are the rules to follow for the update?
There are lots of other questions that will come up

Really, you are in the best position to see how the stored proc should be written
because
You have access to the data.
You know what you want to achieve.
You know the environment you are working in.
You know the design of the database
You can write test queries,UDF's etc etc on your data and run them to see what happens

Think about the above questions and try and come up with ideas to achieve it.
Perhaps you could use a cursor? (Recommended as a last resort)
You can write recursive queries! (This could be the path you should follow)
Maybe some other method there are hundreds?
The help documents can help you there
If you get stuck we are only too happy to help you over the bit you are stuck on.


PS I am trying to be helpfull here
Jul 17 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by replace-this-with-my-name | last post: by
2 posts views Thread by Perttu Pulkkinen | last post: by
14 posts views Thread by Bob | last post: by
1 post views Thread by martinghale | last post: by
10 posts views Thread by AsheeG87 | last post: by
2 posts views Thread by Jim Devenish | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.