Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL-Server-2008
Dear Coders,
I have following query..
I get following data when i fire a query:
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 26-Nov-12 5:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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[^][^]

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 841
1 OriginalGriff 245
2 Volynsky Alex 205
3 Kishore Pogaru 140
4 Magic Wonder 129
0 OriginalGriff 5,640
1 Sergey Alexandrovich Kryukov 4,693
2 CPallini 4,540
3 George Jonsson 3,132
4 Gihan Liyanage 2,445

Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100