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
 General SQL Server Forums
 New to SQL Server Programming
 inserting sequential records into a table

Author  Topic 

htown
Starting Member

2 Posts

Posted - 2012-08-12 : 20:50:17
I have a joomla database that I have created about 160 articles for. I have a hidden menu that each one of these articles needs to be assigned to. The menu already has 40 of the 160 articles. Instead of using the admin interface to the the remaining 140 articles, I would like to create a sql query that will insert the remaining 140 menu items. All I need is the query to cycle 140 times in increase the id on some of the records each time it inserts the new record.

I know very little about sql queries but I have used some of the more simple ones from time to time but I really do not know how to do this one. Any help would be greatly appreciated.

There are 24 fields and 6 of them need to increment each time. Given that the article names are simply numbered, even the names can be created just using a simple +1 each time a new record is inserted.

Hope this makes sense.

Many thanks,
Houston

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-12 : 20:52:20
are you using MySQL or MSSQL as the backend?


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

htown
Starting Member

2 Posts

Posted - 2012-08-13 : 00:27:09
MySQL
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-13 : 10:00:04
quote:
Originally posted by htown

MySQL


then please try posting in MYSQL forums like www.dbforums.com

this is MS SQL forum

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -