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 2000 Forums
 SQL Server Development (2000)
 Insert Range of Numbers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-11 : 08:25:17
William writes "SQL Server 7 SP 3 running on Windows NT 4.0 SP 6

My question is:

I have a table that looks like this:


Column Name Datatype
-----------------------
ID Int
Desc varchar


I want to write an SP that will take 2 parameters one being @range varchar and one being @description varchar

In the @range I would like to pass a string that looks like this "12-20", what the SP would then do is add eight rows into the table one for each ID in the range (eg 12,13,14, etc...) with the description passed as @desc...

So calling uspRangeInsert @range='5-8', @desc='Test' would fill the table like this:


ID Desc
------------
5 Test
6 Test
7 Test
8 Test


Any suggestions would be greatly appreciated!!!

William"
   

- Advertisement -