Is it OK to execute a stored procedure without 'EXEC' or 'EXECUTE' word in the beginning ?
Normally to execute stored procedure I do
EXEC DeleteProfile 'Joe Smith'
But, I've noticed that next command works as well:
DeleteProfile 'Joe Smith'
Why should I write 'EXEC' or 'EXECUTE' word?
Is it ok not to write it before stored procedure name to execute stored procedure?
Thanks.
Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.
You cannot call a procedure in a select statement, because it does not return anything.
The EXEC command is used to execute a stored procedure, or a SQL string passed to it. You can also use full command EXECUTE which is the same as EXEC.
I've found in MSDN "You do not have to specify the EXECUTE keyword when you execute stored procedures when the statement is the first one in a batch."
Get it. Sorry for question.
This wouldn't work without GO at the end of each statement:
DeleteProfile 'Joe Smith'
DeleteProfile 'Joe Smith'
DeleteProfile 'Joe Smith'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With