Anurag
Anurag

Reputation: 572

SQL Server parameter issue

Maybe this is not even a question.. but I have a question which I have a feud with my clients...

I have a SQL Server job which has only one step..

The step is:

EXEC dbo.MyProc 7

while the procedure dbo.MyProc is defined as:

create dbo.MyProc
   (@Param INT = 30)
as 
begin
    some delete statements here taking @Param as the condition in where clause...
end

My questions is about what parameter will the the job work upon.. will it be 7 or will it be 30?

My guess is since 30 is hardcoded in the procedure, the job will run via 30.

I know this question should not have been asked, but I am unable to visualise this..

Pointers and help would be highly appreciated.

Regards

Upvotes: 0

Views: 52

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269723

It looks like you are using SQL Server syntax. The correct syntax is:

create dbo.MyProc (
    @Param int = 30;
)
. . . 

The 30 is a default value, used when no other value is passed in. So, for your question, the value "7" is actually what gets passed in.

Upvotes: 1

Related Questions