Click here to Skip to main content
12,351,798 members (34,536 online)
Rate this:
 
Please Sign up or sign in to vote.
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 26-Nov-12 5:38am

1 solution

Rate this: bad
 
good
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[^]

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

Thanks,
Jitendra
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2016
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