Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
suppose 3 col in that col i want fill 10 record same?
Posted
Comments
Maciej Los 21-Aug-13 3:17am    
I really don't get you ;(
Please, be more specific and provide more details (example data, expected output, etc.).
Member 10219739 21-Aug-13 5:32am    
suppose eg. (id, name) these 2 column in that column i want to fill 10 field these all field are same.eg.
id name
1 abc
1 abc

Maciej Los 21-Aug-13 6:51am    
Still unclear ;(
Thanks7872 21-Aug-13 3:17am    
What is 'that'? Do you think this is a question at all? This can be reported just as an abuse.
Member 10219739 21-Aug-13 5:33am    
suppose eg. (id, name) these 2 column in that column i want to fill 10 field these all field are same.eg.
id name
1 abc
1 abc


1 solution

SQL Is not good with rows that contain the same data repeated - and there is normally a problem with your database or system design if you need to store the same data over and over again.

If you are doing this for testing to provide you with "sample data" then that is one thing - but I'd still suggest using different data (try Lorem Ipsum[^] for a source of "readble" but meaningless data)

Otherwise, just use a loop (provided your row contains an identity column you aren't filling in):
SQL
DECLARE @I INT
SET @I = 0;
WHILE @I < 10
BEGIN
   INSERT INTO MyTable (Model) VALUES('Same Text')
   SET @I = @I + 1
END
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900