var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How to select one record many times?
The developers of frond end ask to select only one row from one table, but many times, such as 10. That means the output has 10 rows and same.
Any suggestion will be appreciated.
SET NOCOUNT ON
CREATE TABLE numbers(n int)
DECLARE @n int
SET @n = 1
WHILE @n < 101
INSERT INTO numbers(n) SELECT @n
SELECT @n = @n + 1
SELECT * FROM Orders CROSS JOIN numbers WHERE OrderID = 10248 AND n < 11
SET NOCOUNT OFF
DROP TABLE numbers
...or cheat a bit with a system table:
...though you should really create a SequentialNumbers table in your database for just such purposes.
select master..spt_values.number as RecordNumber,
where master..spt_values.type = 'P'
and master..spt_values.number < 10
and Orders.OrderID = 10248
Honestly: the front end should do that....
Agreed. You are sending extra 9 rows of data to the front end. That's a waste of bandwidth
Originally Posted by