Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Coders,

I have following query..

I get following data when i fire a query:

UNITECH
PUNJLLOYD
JPASSOCIAT
HDIL
DENABANK
KOKUYOCMLN
ASHOKLEY
IOB

Now what i want to do is when i get this data then one by one i want to update the records one by one based on the values which i got above.

For e.g.After getting the above records i want to update some columns based on formula.The formula will be same for all these records.

Basically this are stock names & i want to update the stock moving AVG based on the condition.

Can this done in one query?

Thanks & Regards.
Posted

1 solution

There is new feature Merge in SQL Server 2008 which is replacement of Cursor.

You can refer below articles to solve your problem:
Merge Statement in SQL Server 2008[^]

http://blog.sqlauthority.com/2008/08/28/sql-server-2008-introduction-to-merge-statement-one-statement-for-insert-update-delete/[^]

Thanks,
Jitendra
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900