I was wondering if there is a way to open an SQL file and execute it from a c# application without prior connection to a database and also get the name of the default server that is used when SSMS is opened.
at the moment i can open SSMS but i can't for the life of me figure out how to get the server name as well as opening and running an SQL file which is a DB creation script.
The reason i ask is because i've been trying to add a function, that will run if there isn't a complete connection string, that will open SSMS, retrieve the servername and execute an SQL script to create a DB.
this is just for a personal interest and would appreciate the help
Thanks in advance