You can pass a literal value or variable, and not something else to EXEC - in particular, you cannot have any form of complex expression or function call 1 . Therefore, if you want to calculate the value, you need to put this in a variable in a separate statement:
CREATE TABLE
In addition, you should avoid naming stored procedures starting with sp_ :
Avoid using the sp_ prefix in the naming procedure. This prefix is ββused by SQL Server to refer to system procedures. Using a prefix can lead to a break in the application code if there is a system procedure with the same name.
1 Martin points out that some functions can be called, but this is the exception rather than the rule, therefore, although my statement is not 100% accurate, considering it doesnβt harm you.
source share