I want to execute tsql scripts from custom cmdlet written in c#. Can you recommend me the best practice to do it?
I have a few .sql scripts and in my cmdlet I need to iterate through them in specific order and execute each sql script. I also need to run all scripts in transaction if is it possible.
And I need to execute scripts remotely. It means, that there may not be sql server installed on the machine from which is cmdlet executed.
The target sql servers are 2008, 2008R2, 2012.
I have read some approaches, but i'm still not sure what is the best one.
thanks in advance