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
 Old Forums
 CLOSED - General SQL Server
 Can u answer for this question ??????????

Author  Topic 

vass
Starting Member

12 Posts

Posted - 2007-01-02 : 00:39:39
Hi All,

I want solution for this problem . I have single record in my table but when i select , i want show record's n times WithOut DML operations.


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-02 : 06:42:35
SELECT t.* FROM <YourTableNameHere> AS t
CROSS JOIN (SELECT Number FROM master..spt_values WHERE Name IS NULL AND Number BETWEEN 1 AND <YourNtimesValueHere>) x


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-02 : 06:44:55

1 Where do you want to show data?
2 What do you mean by i want show record's n times WithOut DML operations.?

Madhivanan

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

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-01-02 : 08:36:33
quote:
Originally posted by vass

Hi All,

I want solution for this problem . I have single record in my table but when i select , i want show record's n times WithOut DML operations.






Since a SELECT statement is a DML statement, how would it be possible?



CODO ERGO SUM
Go to Top of Page

vass
Starting Member

12 Posts

Posted - 2007-01-03 : 00:58:51
quote:
Originally posted by Peso

SELECT t.* FROM <YourTableNameHere> AS t
CROSS JOIN (SELECT Number FROM master..spt_values WHERE Name IS NULL AND Number BETWEEN 1 AND <YourNtimesValueHere>) x


Peter Larsson
Helsingborg, Sweden



Thanks peter larsson
From Vass
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-03 : 07:57:52

But you didnt reply on the questions asked

Madhivanan

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

vass
Starting Member

12 Posts

Posted - 2007-01-04 : 01:14:17
quote:
Originally posted by Peso

SELECT t.* FROM <YourTableNameHere> AS t
CROSS JOIN (SELECT Number FROM master..spt_values WHERE Name IS NULL AND Number BETWEEN 1 AND <YourNtimesValueHere>) x


Peter Larsson
Helsingborg, Sweden



is there any other way to get this result without using the systables
because it affects not only performance and also the limited number only avalibale on the table.
Go to Top of Page

vass
Starting Member

12 Posts

Posted - 2007-01-04 : 01:29:16
quote:
Originally posted by madhivanan


1 Where do you want to show data?
2 What do you mean by i want show record's n times WithOut DML operations.?

Madhivanan

Failing to plan is Planning to fail



Assume table has only one record when select the record from the table i want show that record as many as i want .

create table test (no int ,name varchar(20))

insert test
select 1,'test'

i want show that reocrd five time's(dynamicaly) ...
select no,name from test

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-04 : 07:39:59
Can I know the reason why you want to replicate the rows?
And where do you want to show the replicated data?

Madhivanan

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

vass
Starting Member

12 Posts

Posted - 2007-01-05 : 07:01:06
quote:
Originally posted by madhivanan

Can I know the reason why you want to replicate the rows?
And where do you want to show the replicated data?

Madhivanan

Failing to plan is Planning to fail



i have an requirement that i want split single data based on the number user's enter the number in the front end ...
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2007-01-05 : 07:05:24
This is post-processing, better suited to the application layer logic.

-------
Moo. :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-01-05 : 07:41:18
Then Do it in the front end is the correct answer

If you use front ends like VB6, try something like

For i=1 to Trim(textbox.text)
Print Rs("column")
Next i


Madhivanan

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

- Advertisement -