By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

Insert table values from other table

P: 21
Hi Guys,

Thanks in advance for your help. I unpivoted a table which I want to insert into another table. Below is my script. I got an error; anyone can see where my error is.

insert into MASTER_FINANCIALS (
[ISIN]
,[Ticker]
,[Company_Name]
,FINANCIAL_DESC
,FINANCIAL_VALUES
,KPI_CATEGORY
,DATE_PERIOD
(
SELECT
[ISIN]
,[Ticker]
,[Company_Name]
,FINANCIAL_DESC
,FINANCIAL_VALUES
, 'KPI_MARGINS' AS KPI_CATEGORY
, 'Q42007' AS DATE_PERIOD

FROM
(
SELECT [Ticker]
,[ISIN]
,[Company_Name]
,[Operating_Margin]
,[EBITDA_Margin]
,[Net_Profit_Margin]
FROM [CRDA_MASTER].[dbo].[Margins]
) P
UNPIVOT
( FINANCIAL_VALUES FOR FINANCIAL_DESC IN
([Operating_Margin]
,[EBITDA_Margin]
,[Net_Profit_Margin]
)
)AS UNPVT
) FORECAST
GO

thanks agina!
Nov 12 '09 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Assuming your entire SELECT part works, the only error am seeing is the missing parenthesis after the list of columns on the INSERT clause.

Happy Coding!!!

--- CK
Nov 12 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.