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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Adding new records

Author  Topic 

Hym1988
Starting Member

4 Posts

Posted - 2012-01-05 : 16:27:42
Hello I have question.

I have a table like this.



There is shown only 38 records but i have about 700.

What i want to do... i want to add 400 more records.


And every records will look that same. What I mean:

JID......silk_own.....silk_gift....silk_point

701......200.................0.................0
702......200.................0.................0
703......200.................0.................0


etc until JID will reach 1150.

Is this possible to do it faster and easier than manualy?

regards

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-05 : 20:46:45
In a query window in SQL Server Management Studio, execute this:
INSERT INTO YourTable
(JID, silk_own, silk_gift, silk_point)
SELECT
701 + Number,
200,
0,
0
FROM
MASTER..spt_values p
WHERE
p.type = 'P'
AND 701+Number <= 1150;
Before you execute, if you remove the first two lines and execute only the section starting with the SELECT, you can see what it is going to insert.
Go to Top of Page

Hym1988
Starting Member

4 Posts

Posted - 2012-01-06 : 09:22:49
THANK YOU! Works like a harm. You saved me <3
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-06 : 10:29:27
quote:
Originally posted by Hym1988

THANK YOU! Works like a harm. You saved me <3



You are quite welcome, but I am sorry that the query is working like "HARM"
Go to Top of Page
   

- Advertisement -