KPoggensee
Programmer
I have a proprietary application that generates its own IDs internally. I have replicated the logic in a Stored Procedure.
If I issue:
EXEC MyNewID @TableName = 'Account'
I get the ID correctly back.
I now need to impliment this in an INSERT INTO ....
I'm only trying to select the records that I want to insert first but am having problems calling the Proc.
Here is what I got:
SELECT EXEC MyNewID @TableName = 'Account',
AccountName,
AccountType,
AccountWebAddress
FROM ImportStagingTable
Here is what I get:
"Incorrect Syntax near the keyword 'EXEC'
So here is my question?
Is it possible to call a Stored Proc in a SELECT statement like I am trying to do, to use in an INSERT INTO...
If so, How? If not what are my alternatives?
Thanks in advance for you advise.
If I issue:
EXEC MyNewID @TableName = 'Account'
I get the ID correctly back.
I now need to impliment this in an INSERT INTO ....
I'm only trying to select the records that I want to insert first but am having problems calling the Proc.
Here is what I got:
SELECT EXEC MyNewID @TableName = 'Account',
AccountName,
AccountType,
AccountWebAddress
FROM ImportStagingTable
Here is what I get:
"Incorrect Syntax near the keyword 'EXEC'
So here is my question?
Is it possible to call a Stored Proc in a SELECT statement like I am trying to do, to use in an INSERT INTO...
If so, How? If not what are my alternatives?
Thanks in advance for you advise.