﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Get Records according to dataset. / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 12:14:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>[quote][b]dwain.c (11/18/2012)[/b][hr][quote][b]CELKO (11/18/2012)[/b][hr]Yes, we can help you be a bad SQL programmer, if you [i]really want to be[/i] a bad programmer. But why? [/quote]So you can be promoted to a management position of course![/quote]:hehe:  Classic reply, and so true.....</description><pubDate>Mon, 19 Nov 2012 02:53:29 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>[quote][b]abdul_rouf26 (11/18/2012)[/b][hr]Many many thanks SSCommitted.You solved my problem.:-)[/quote]While many have suggested that I should be committed, my board handle is actually Dwain.C!You're welcome anyway.</description><pubDate>Mon, 19 Nov 2012 00:00:11 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>Many many thanks SSCommitted.You solved my problem.:-)</description><pubDate>Sun, 18 Nov 2012 23:57:41 GMT</pubDate><dc:creator>abdul_rouf26</dc:creator></item><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>[quote][b]CELKO (11/18/2012)[/b][hr]Yes, we can help you be a bad SQL programmer, if you [i]really want to be[/i] a bad programmer. But why? [/quote]So you can be promoted to a management position of course!</description><pubDate>Sun, 18 Nov 2012 20:18:01 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>[quote] I have a CTE Query but I have no concept about it. And I am new in programming. [/quote]And you are doing it wrong. Rows are not records. Tables are not files. The goal of a database is to [b]remove [/b]redundancy; you want to [b]increase [/b]it. All wrong. What you are doing is using SQL to print a deck of punch cards. You are not writing RDBMS! Yes, we can help you be a bad SQL programmer, if you [i]really want to be[/i] a bad programmer. But why? You saw a recursive CTE, and it looks like a loop so you want to use it. But SQL is a declarative language and we hate loops. What are you actually trying to do?</description><pubDate>Sun, 18 Nov 2012 20:14:40 GMT</pubDate><dc:creator>CELKO</dc:creator></item><item><title>RE: Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>You can use a more efficient numbers table that returns numbers up to 1000:[code="sql"];WITH Nbrs ( Number ) AS (    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL))    FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t1 (n1)    CROSS JOIN (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t2 (n2)    CROSS JOIN (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t3 (n3))[/code]</description><pubDate>Sun, 18 Nov 2012 19:28:07 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>Get Records according to dataset.</title><link>http://www.sqlservercentral.com/Forums/Topic1386126-392-1.aspx</link><description>Hello Expert !I have a CTE Query but I have nothing concepts about it. And I am new in programming. Actually i have Qty column in my query and i want repeat rows until qty. means if qty is equal to 50 then data set returns me 50 time records. if qty is equal to 1000 thousand then query returns me 10000 thousand records. Following query works fine for me till &amp;lt;99 rcords how can i grow for 1000 rocords.Thanx in advance.[code="sql"]SELECT * INTO #TableAFROM ( 	SELECT MIS_Request_Detail.vno, MIS_Request_Detail.IID, MIS_Request_Detail.Qty-MIS_Request_Detail.BalQty qty, 			1 RcvdQty, pk,			ItmMstr.IName, ItmMstr.UName, '' SrNo,			MIS_Request_Detail.Qty As ReqQty, MIS_Request_Detail.BalQty, MIS_Request_Detail.Qty-MIS_Request_Detail.BalQty RemainQty    FROM MIS_Request_Detail INNER JOIN    view_MIS_Item_Master ItmMstr ON ItmMstr.IID=MIS_Request_Detail.IID    WHERE ReqType=1 AND MIS_Request_Detail.vno='00008/1012'    ) T	;WITH Nbrs ( Number ) AS (    SELECT 1 UNION ALL    SELECT 1 + Number FROM Nbrs WHERE Number &amp;lt; 99 )SELECT   A.vno,A.IID, A.IName, A.UName, CAST(SrNo AS VARCHAR(50)) SrNo, CAST(N.Number AS varchar(50)) QTY, pk ReqDetpk, RcvdQty,   A.ReqQty, A.BalQty, A.RemainQty, 0 Color,  0 chked, 0 Pk, 0 AS isupdate, '' AS isdeletedFROM   #TableA A   JOIN   Nbrs N ON N.Number &amp;lt;= A.qtyORDER BY IID, N.Number, pk [/code]</description><pubDate>Sun, 18 Nov 2012 19:00:22 GMT</pubDate><dc:creator>abdul_rouf26</dc:creator></item></channel></rss>