I need to run a script like
EXEC sp_dbcmptlevel AdventureWorks, 100;
GO
Now I'd like to have a generic version that uses the database I am connected to, is it possible in T-SQL?
Something like this, but this doesn't work:
EXEC sp_dbcmptlevel DBNAME(), 100;
GO
It doesn't work of course because a string is returned, I'd like to have the database referece returned... Is it possible?
Note Of course I can do it from a client application and using a parameter, like (Delphi example)
EXEC sp_dbcmptlevel :CurrentDatabase, 100;
GO
and replace it at runtime, but I'd like to have T-SQL only code.