Last active
February 22, 2017 03:17
-
-
Save metaskills/0cb3345be80c3915ba6b08f417f40cd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tiny_tds' | |
puts 'Connecting to SQL Server' | |
@client = TinyTds::Client.new( | |
host: 'localhost', port: 1433, | |
username: 'sa', password: ENV['SA_PASSWORD'], | |
) | |
def execute(sql) | |
@client.execute(sql).do | |
true | |
end | |
puts 'Creating Database' | |
execute "CREATE DATABASE SampleDB" | |
@client.close | |
puts 'Done' | |
# Output | |
Connecting to SQL Server | |
Creating Database | |
Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment