I am just trying to script some basic stuff using SQLCMD from query editor.

I wanted to execute the same sql statements but in different sql servers and want to see the output. This has nothing to do with performance but the idea is to just check the data in different servers that we migrated. I just learnt SQLCMD would be very helpful here but wonder how to script this. Just assume same db and tables exist in all servers. So far, I do the below to get what I need and I am sure this could be done a lot more nicely !

```
:Connect Server1
SELECT count (*) FROM [DB].[dbo].[Table1]
SELECT count (*) FROM [DB].[dbo].[Table2]

:Connect Server2
SELECT count (*) FROM [DB].[dbo].[Table1]
SELECT count (*) FROM [DB].[dbo].[Table2]

:Connect Server3
SELECT count (*) FROM [DB].[dbo].[Table1]
SELECT count (*) FROM [DB].[dbo].[Table2]

```

Thank you !