Discussion:
Inline expression for INSERT INTO
(too old to reply)
Nestor
2008-03-09 01:24:18 UTC
Permalink
How can I use an inline expression instead of @TrainTable in this DMX
expression?

INSERT INTO MINING MODEL [TwoLinesData_InSample_ModelRuns_99991231_235959] (
[DateS]
,[Line]
,[X]
,[Y]
) @TrainTable

Something like

Select '2001-01-01' as DateS, "Line1" as Line, 1.1 as X, 2.2 as Y
union all
Select '2001-01-02' as DateS, "Line2" as Line, 2.2 as X, 3.3 as Y

I know you can do it for PREDICTION JOIN as shown below. But I cannot find a
way to do it in an INSERT INTO command.

SELECT
T.Y as [Actual]
,Predict([Y]) as [Predict]
FROM [TwoLinesData_InSample_ModelRuns_99991231_235959]
NATURAL PREDICTION JOIN (
SELECT
'1/1/2000 12:04:00 AM' as [DateS],
'Line1' as [Line],
5.36 as [X],
38.10729061 as [Y]
) AS T


Many thanks, Nestor
Dejan Sarka
2008-03-22 07:47:29 UTC
Permalink
I think you could do this by using source that supports Union, for example
SQL Server, and Openquery DMX function
INSERT INTO model
OPENQUERY([SQL Server Data Source],'Select ... Union Select...]')
--
Dejan Sarka
http://blogs.solidq.com/EN/dsarka/default.aspx
Post by Nestor
expression?
INSERT INTO MINING MODEL [TwoLinesData_InSample_ModelRuns_99991231_235959] (
[DateS]
,[Line]
,[X]
,[Y]
Something like
Select '2001-01-01' as DateS, "Line1" as Line, 1.1 as X, 2.2 as Y
union all
Select '2001-01-02' as DateS, "Line2" as Line, 2.2 as X, 3.3 as Y
I know you can do it for PREDICTION JOIN as shown below. But I cannot find
a way to do it in an INSERT INTO command.
SELECT
T.Y as [Actual]
,Predict([Y]) as [Predict]
FROM [TwoLinesData_InSample_ModelRuns_99991231_235959]
NATURAL PREDICTION JOIN (
SELECT
'1/1/2000 12:04:00 AM' as [DateS],
'Line1' as [Line],
5.36 as [X],
38.10729061 as [Y]
) AS T
Many thanks, Nestor
Loading...