Link to home
Start Free TrialLog in
Avatar of flyingsquirel
flyingsquirelFlag for New Zealand

asked on

SQL Break single rows into multiple rows

Hi,
This should be a pretty simple task for a SQL guru. Its just a little complicated for me with the nesting.
I have a table consisting of the data I need to populate another table. However in the target table the data needs to be split into multiple rows per "item" which has a unique identifier.

I need a query that will basically take each column of the source table row and add it to a separate row in the TARGET table. I have set up a few rows of each below.The data in the TARGET table is always the same for each item id. So the query needs to create the SET of rows for EACH of the line items in the SOURCE table.
SOURCE:

[ID]    [service]     [time]    [price]
59	Golden  	30	45.00
60	Sparkle 	30	45.00

TARGET

[id]	AllowCancellations	True
[id]	AllowRescheduling	True
[id]	AppointmentDuration	[time]
[id]	AppointmentDurationMax	[time]
[id]	AppointmentInterval	[time]
[id]	CancellationFee	        0.00
[id]	DaysAhead	         30
[id]	MaxAppointments  	4
[id]	MinTimeAhead	       00:00:00
[id]	ReschedulingFee	        0.00
[id]	SchedulingFee	        [Price]

Open in new window

SOLUTION
Avatar of LeDaouk
LeDaouk
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of flyingsquirel

ASKER

Both Worked perfectly.