Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create data from a range
Message
From
17/10/2014 07:11:21
 
 
To
17/10/2014 06:50:58
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
Application:
Web
Miscellaneous
Thread ID:
01609576
Message ID:
01609577
Views:
38
>Hi
>
>I have a list of data
>
>ID From To
>1001 100 103
>
>I want to use this to create data rows in another table
>
>ID Type
>1001 100
>1001 101
>1001 102
>1001 103
>
>any thoughts on the best way to do this in sql
>
>Thanks
>
>Nick

I've got it thanks
 WITH each AS
(
    SELECT an_eventid,  an_label_range_start AS n, an_label_range_end
      FROM SERVER01.dbo.campaign where an_label_range_start is not NULL
    UNION ALL
    SELECT an_eventid,  n + 1, an_label_range_end
      FROM each
     WHERE n + 1 <= an_label_range_end
)
SELECT an_eventid,  n
FROM each order by an_EventID,n 
Previous
Reply
Map
View

Click here to load this message in the networking platform