Last active
March 17, 2017 13:32
-
-
Save metaskills/5bf99b67fa5c2473839981130c2d233b to your computer and use it in GitHub Desktop.
This file contains hidden or 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'], | |
| database: 'SampleDB' | |
| ) | |
| def execute(sql) | |
| @client.execute(sql).do | |
| true | |
| end | |
| execute "CREATE TABLE Employees (Id INT IDENTITY(1,1) NOT NULL PRIMARY KEY, Name NVARCHAR(50), Location NVARCHAR(50))" | |
| execute "INSERT INTO Employees (Name, Location) VALUES (N'Jared', N'Australia'), (N'Nikita', N'India'), (N'Tom', N'Germany')" | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment