sqlcmd -S %1 -i select.sql -v dbname = %2 tablename = %3 -o %4
select.sql
use $(dbname)
select * from $(tablename)
or
then you can also do in select.sql
DECLARE @dbname1 as varchar(150)
SET @dbname1 = '$(dbname)'
in sql and use it across the script to create dynamic sql
No comments:
Post a Comment