No announcements
Found 659910 threads
-
1 Votes
Union in while loop
As you should avoid using loops in general..there are some other tricks like Recutrsive CTE and may be a UNION ALL that you shoud try first...Answered | 1 Replies | 12813 Views | Created by Sri Avani - Friday, March 18, 2011 5:07 AM | Last reply by Chintak Chhapia - Friday, March 18, 2011 6:15 AM -
1 Votes
union all in While Loop
If you want to store the results of each loop, you will need to create a table variable DECLARE @intFlag INT = 1 DECLARE @t table (intFlag ...Answered | 1 Replies | 22180 Views | Created by nikijain - Thursday, September 8, 2011 5:09 AM | Last reply by JLHui - Thursday, September 8, 2011 6:20 AM -
0 Votes
how to union query ouput in while loop
you can also append the query in a temp string separating them by union or union all and when loop ends execute the query.Answered | 2 Replies | 5982 Views | Created by Sri Avani - Wednesday, March 16, 2011 7:36 AM | Last reply by bahushekh - Wednesday, March 16, 2011 8:23 AM -
2 Votes
Union in loop
We do not write loops in SQL because it is declarative; not like your COBOL programming.Answered | 4 Replies | 5028 Views | Created by Vineeth Paliath - Monday, August 9, 2010 9:32 AM | Last reply by --CELKO-- - Sunday, August 28, 2011 4:46 PM -
0 Votes
while loop?
As many other user have also suggested, While Loop is not the preferred way to write any SQL. in your case you can easily write your query in set based fashion. check the below ...Answered | 12 Replies | 1518 Views | Created by Dave Parker - Wednesday, April 16, 2014 8:21 PM | Last reply by Dave Parker - Saturday, April 19, 2014 3:39 PM -
6 Votes
While loop VS For loop
The first example you provided contravenes the commonly accepted semantic and would be better served semantically by the while loop.Answered | 12 Replies | 13307 Views | Created by GR4YF0X - Friday, March 12, 2010 5:50 PM | Last reply by CS001 - Thursday, April 1, 2010 7:57 PM -
0 Votes
While Loop Not Working
' with '<' in your WHILE condition; while(@num>=10) --> Wrong while(@num<=10) --> ...Answered | 3 Replies | 717 Views | Created by AKPallai - Wednesday, February 10, 2016 9:38 AM | Last reply by Atif-ullah Sheikh - Wednesday, February 10, 2016 12:40 PM -
4 Votes
For or while loop
In 'for' loop - the loop executes for n number of times In 'while' loop, the loop executes while a condition is true ...Answered | 3 Replies | 1812 Views | Created by Nosyarg - Sunday, November 6, 2011 10:30 PM | Last reply by Murugan A - Monday, November 7, 2011 9:17 AM -
4 Votes
Can we use While loop in CTE?
As Stefan said, you cannot; however, there might be times in which you can loop through your CTE with a table of numbers -- for instance: declare @numbers table(n ...Answered | 3 Replies | 25822 Views | Created by SequelBug - Wednesday, July 13, 2011 9:10 AM | Last reply by Kent Waldrop - Wednesday, July 13, 2011 11:18 AM -
0 Votes
Why the While loop outside the for loop?
The purpose of the while loop is to confirm that the 4 server threads are busy, if we looped on the 4 servers by using the for loop only it could be 2 of them are ...Answered | 2 Replies | 510 Views | Created by kgr_452 - Tuesday, April 28, 2015 7:33 AM | Last reply by Fouad Roumieh - Tuesday, April 28, 2015 8:15 AM -
1 Votes
While loop to load a temp table
Hi, Please take a look to avoid aggregation operation in a loop.Answered | 4 Replies | 2067 Views | Created by siera_gld - Saturday, April 26, 2014 3:25 PM | Last reply by siera_gld - Saturday, April 26, 2014 5:36 PM -
1 Votes
While Loop
> I am trying to create a while loop and enter the last 45 days into a temp table for a proc...Answered | 2 Replies | 1832 Views | Created by siera_gld - Monday, April 8, 2013 9:34 PM | Last reply by --CELKO-- - Monday, April 8, 2013 10:00 PM -
1 Votes
Looping through two unions of non-contiguous ranges
Each separate range of the Union is an Area and you work in the Areas of the Unions.Answered | 2 Replies | 3358 Views | Created by NiklasKokeritz - Thursday, February 16, 2012 2:38 PM | Last reply by OssieMac - Thursday, February 16, 2012 8:08 PM -
0 Votes
While Loop with 'OR' condition
> Can someone tell me the syntax for an 'OR' condition (I suppose and 'AND' as well) within a while loop?Answered | 2 Replies | 478 Views | Created by Casey_M - Thursday, January 29, 2015 8:15 PM | Last reply by Edward8520 - Monday, February 2, 2015 8:02 AM -
0 Votes
should I use loop with Union
nbsp; from ( select BintEmployeeID,DtAttendanceDate,BitIspresent,ROW_NUMBER()over (partition by ...Answered | 1 Replies | 497 Views | Created by VMuradiya - Tuesday, February 3, 2015 7:04 AM | Last reply by Visakh16 - Tuesday, February 3, 2015 7:55 AM -
0 Votes
SQL dynamic while loop question, please help
With this assumption, this can be achieved as follows DECLARE @ITEM_LIST TABLE(ID INT, NAME VARCHAR(20), PARENT ...Answered | 6 Replies | 2151 Views | Created by LucasCoding - Wednesday, August 8, 2012 5:13 PM | Last reply by LucasCoding - Wednesday, August 8, 2012 8:45 PM -
1 Votes
Difference between union and union all.
sandip, UNION provides the distinct set of results, while UNION ALL provides the entire result set.Answered | 3 Replies | 1486 Views | Created by BhaSandy - Tuesday, February 11, 2014 8:25 AM | Last reply by Jayakumaur (JK) - Tuesday, February 11, 2014 9:36 AM -
1 Votes
Help with Do While loop
I don't understand your insistence that a While loop tests the condition at the start of the loop.Answered | 11 Replies | 618 Views | Created by Lezgettdrunk - Saturday, September 5, 2015 11:41 PM | Last reply by Dave299 - Monday, September 7, 2015 12:54 AM -
0 Votes
How to Union while using Function?
> I Have List of Companies [no, a table is not a list],I need to union to display [a presentation layer does display; we write queries that get the data] all Companies as select all how ...Answered | 5 Replies | 871 Views | Created by Sasicumaar - Wednesday, November 27, 2013 4:07 AM | Last reply by --CELKO-- - Thursday, November 28, 2013 2:50 AM -
5 Votes
Question about for and while loop
; result); Why is the result of while loop 15?Answered | 11 Replies | 2949 Views | Created by Ivan Terrible - Sunday, October 9, 2011 9:21 AM | Last reply by Ivan Terrible - Tuesday, October 11, 2011 6:29 PM - Items 1 to 20 of 659910 Next ›
No announcements