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.
| Author |
Topic |
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2010-02-04 : 12:05:52
|
| I have to count whole users and display iti have write query as :declare @count intdeclare @uid varchar(10)set @uid=''declare @i intset @count=0set @i=1select @count= count(*) from empselect @uid=eid from emp order by eidbegin while(@i<=@count) begin print @uid set @i=@i+1 endendhelp mehttp://kiransoftech.com |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 12:10:54
|
| sorry your query doesnt make sense. what are you trying to do inside loop? as of now, it just prints a random id value in emp table repeatedly for count value number of times |
 |
|
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2010-02-04 : 12:15:17
|
| no , firstly I have to count whole data and display data one by onehttp://kiransoftech.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 12:16:51
|
| why count for displaying all the data . wont this be enough?select eid from emp order by eid |
 |
|
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2010-02-04 : 12:24:09
|
| yes, i know this query but want to do with it functionactually my case is : Find Users one by one and do transaction in another Tableso counting whole data and display data one by onehttp://kiransoftech.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 12:26:58
|
| but if at all possible go for set based approach. one by one processing will be slow. what will be transaction perfomed for each user? |
 |
|
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2010-02-04 : 12:35:53
|
| Yes It will be slow process. but i want to know the Steps , how to process using Functionhttp://kiransoftech.com |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 12:40:42
|
quote: Originally posted by vedjha Yes It will be slow process. but i want to know the Steps , how to process using Functionhttp://kiransoftech.com
which function? i cant see function in posted code |
 |
|
|
|
|
|