Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CURSOR ASSISNGMENT

Author  Topic 

pnpsql
Posting Yak Master

246 Posts

Posted - 2011-08-31 : 01:41:31
dear all, i need to assign some values to cursor i have declared but there is no table from where i select the values, how can i do this .

pls suggest..





challenge everything

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-31 : 01:50:55
so you're values are static constant values? then whats the point of cusror?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pnpsql
Posting Yak Master

246 Posts

Posted - 2011-08-31 : 01:54:52
i need looping one by one , is thre another way.


challenge everything
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-31 : 02:01:01
yep. put themin a temporary table then apply a cursor on it
If you can explain what you're trying to do we might be able to suggest a best way. Who knows, we can even avoid cursors if it doesnt necessarily require implementing

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pnpsql
Posting Yak Master

246 Posts

Posted - 2011-09-02 : 01:18:38
can it be done using
select 1
union all
select 2
union all
select 3




challenge everything
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-02 : 02:00:48
you can do this way also but you have not yet given us any details on what exactly is your scenario

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-09-05 : 05:42:42
quote:
Originally posted by pnpsql

i need looping one by one , is thre another way.


challenge everything


Give us full details of what you are trying to do. There may better way of what you are thinking

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -