input parameter to scripts run by osql | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

input parameter to scripts run by osql

Is there anyway for osql scripts to accept input parameters to make them more flexible? For example I would like a script to search for all user defined procedure in a database. I don’t want to create a different script for each database in my instance. If the script can accept a database parameter, I can use this one script for all databases. I know you can specify an input file with the -i option but I am talking about an input parameter to the script (not the input script itself). I also know that you can use the -d option to specify which database to run script against but I am looking for flexibility for future scripts as well. Thank You,
Jethro
I think the only way you can achieve this is to programmatically alter the input file to include the parameter first, using OS-commands. osql doesn’t accept params. basically, if you have to do this, it’s going to be awkward. what’s the source of the params? you choosing them on the fly? depends what your requirements are.. Tom Pullen
DBA, Oxfam GB
]]>