This question already has an answer here:
I have a code which looks like:
const query = `select *
from %s.dbo.table1
join %s.dbo.table2
on ....
join %s.dbo.table3
on ....
join %s.dbo.table4
on ....`
fmt.Sprintf(query, dbName, dbName, dbName, dbName)
I just create a SQL query by inserting the database name to all %s
occurrences. Is the a better way to do it without repeating dbName
?
</div>