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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-28 : 13:29:15
|
Joe writes "I have looked extensively for the answer to this, but have not found a concise way to do this. I am running on SQL server version 7.0 and I am trying to insert rows into a table based on beginning and ending values stored in another table. For example:Specifications table (key, hbegin, hend, vbegin, bend)0 100 112 100 1501 138 149 120 170I want to insert rows into a table so that it looks like the following0 100 1000 100 1010 100 102...0 100 1500 101 100...0 112 1501 138 120...1 149 170 I have tried creating an insert inside multiple loops (all in the stored procedure), but have not had any success.Any ideas?Joe" |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2001-12-28 : 14:42:31
|
| Joe, this is probably a good use for a sequence table. You'll get some ideas from these articles [url]http://www.sqlteam.com/SearchResults.asp?SearchTerms=sequence[/url].The one Answering a SQL Query Question from a Recruiter has an example of building a table with series of dates given a begin and end. You should be able to modify this to deal with integers as well. Be sure to read the other articles for a better understanding of sequence tables, too.--------------------------------------------------------------1000 Posts, Here I come! I wonder what my new title will be... |
 |
|
|
|
|
|