I need to populate an existing table with the same data contained in/returne
d
from an inline function table. An external app uses the data from the inlin
e
function table in a form. I need to be able to update that data also in a
form, so I need to populate an existing table with the same data. Yes, I
could write an sp and some code, but I am just checking if there is a way to
grab the data from the inline function table to place in the existing table.
I tried Insert Into in the function - which it said is not allowed.
My issue is that the function takes a lot of arguments (10 args). From the
form, all I have to do is say
Frm.Recorsource = "Select * from dbo.f_data(" & strArgs & ")"
It would take way more code to do the same thing with an SP and 10 Params.
Is there a way to grab the inline function table data?
Thanks,
RichAre you saying that you cannot use an inline function as the source for a SE
LECT which is the source
for an INSERT? This is not what I am seeing:
USE tempdb
GO
CREATE TABLE a(c1 int, c2 int)
GO
CREATE FUNCTION f()
RETURNS TABLE
AS
RETURN(
SELECT 1 AS c1, 11 AS c2
UNION ALL
SELECT 2 AS c1, 22 AS c2
)
GO
INSERT INTO a(c1, c2)
SELECT c1, c2 FROM f()
GO
SELECT * FROM a
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:088A39C0-59BB-4037-81F8-F777F7C8FF90@.microsoft.com...
>I need to populate an existing table with the same data contained in/return
ed
> from an inline function table. An external app uses the data from the inl
ine
> function table in a form. I need to be able to update that data also in a
> form, so I need to populate an existing table with the same data. Yes, I
> could write an sp and some code, but I am just checking if there is a way
to
> grab the data from the inline function table to place in the existing tabl
e.
> I tried Insert Into in the function - which it said is not allowed.
> My issue is that the function takes a lot of arguments (10 args). From th
e
> form, all I have to do is say
> Frm.Recorsource = "Select * from dbo.f_data(" & strArgs & ")"
> It would take way more code to do the same thing with an SP and 10 Params.
> Is there a way to grab the inline function table data?
> Thanks,
> Rich
No comments:
Post a Comment