Skip to content

Instantly share code, notes, and snippets.

@rkitover
Created March 17, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkitover/2063477 to your computer and use it in GitHub Desktop.
Save rkitover/2063477 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use DBI;
use strict;
use warnings;
my $h = DBI->connect(@ENV{map "DBICTEST_MSSQL_ODBC_$_", qw/DSN USER PASS/},
{RaiseError => 1, PrintError => 0}
);
eval { $h->do(q/drop table owners/); };
$h->do(q/create table owners (id int identity (1,1) not null, name varchar(100))/);
my $s = $h->prepare_cached(<<"EOF");
SET IDENTITY_INSERT owners ON
insert into owners (id, name) values (?,?)
SET IDENTITY_INSERT owners OFF
SELECT SCOPE_IDENTITY()
EOF
my @data = ([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
['wiggle',
'woggle',
'boggle',
'fRIOUX',
'fRUE',
'fREW',
'fROOH',
'fISMBoC',
'station',
'mirror',
'dimly',
'face_to_face',
'icarus',
'dream',
'dyrstyggyr']);
$s->execute_array(undef, @data);
eval { $h->do(q/drop table owners/); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment