I have a table that stores every time a script is run. My issue is that I have to enter in the script name manually in the ‘????” and am looking for a way so it would automatically just pass the script name into the insert statement. My current script is (see below)
declare @ScriptName varchar(100)
--Replace ???? with the script name being executed
Set @ScriptName = '?????'
insert into dbhistory (dbh_memo, dbh_user, dbh_nowversion)
Values(@ScriptName, 'Boss','Version 758')
If you’re trying to get the name of the stored procedure (I don’t know if that’s what you mean by “script”) and if this is SQL Server, you can use this: