March 31, 2003 at 3:10 am
The story:
There is a table with a trigger on it. The trigger calls a stored procedure. The stored procedure has no paramters, and the trigger does not pass any parameters to it.
STILL, when inserting in the table an error occures: "Procedure .... has no parameters and arguments were supplied."
Did anybody came across a similar problem?
PS: Probably it's just a simple minor thing that I am missing, but still, any ideas could help, even if they are the most common ones.
Boti
🙂
March 31, 2003 at 4:22 am
Is it possible to supply the code for the Trigger?
/Hanslindgren
March 31, 2003 at 8:16 am
Here is the trigger:
-- trigger start
CREATE TRIGGER Trig1 ON dbo.Tabel1
FOR INSERT, UPDATE, DELETE
AS
--return
-- comment1
declare @date smalldatetime, @first smalldatetime
set @date = dbo.func1('param') -- comment
-- comment
select *
into #TmpTable from
(
select Date, Code from deleted where (Date=@Date)
union
select Date, Code from inserted where (Date=@Date)
) codes
-- comment
exec StoredProc
-- trigger end
🙂
March 31, 2003 at 9:09 am
Could dbo.Func1 be defined without parameters?
My error msg is when I do that is:
Server: Msg 8144, Level 16, State 2, Line 2
Procedure or function dbo.Func1 has too many arguments specified.
But maybe the wording could differ between servicepacks?
Otherwise try to do a ODBC call:
{CALL StoredProc ()}
Wild shot: maybe the sp gets some sideffects beeing just before the end of the trigger?
Otherwise, unfortunatly, I have no other suggestions
March 31, 2003 at 9:23 am
Func1 works just fine.
I've simulated the trigger from Query Analyzer (removed the first line "create trigger etc." and replaced the "from deleted" and "from inserted" part with a select statement) and the simulation worked just fine, too. 🙂
But when in trigger, I get that error. :((
🙂
March 31, 2003 at 10:44 am
Did you try the ODBC call instead of your 'exec StoredProc'?
March 31, 2003 at 10:23 pm
What do you mean by ODBC calling?
In my case everything has to happen on the server...
🙂
April 1, 2003 at 1:06 am
Quoting BOL:
quote:
To run a procedure as an RPCConstruct a SQL statement that uses the ODBC CALL escape sequence. The statement uses parameter markers for each input, input/output, and output parameter, and for the procedure return value (if any):
{? = CALL procname (?,?)}
I wrote it in my Reply earlier: {CALL StoredProc ()}
I have not yet done had the time to do enough testing to see preformance difference in SPs but I have not seen any preformance degrading when using this on application level with OLE driver.
If anyone knows more about this please let me know!
Regards, Hanslindgren
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply