SQLServer.gms : Test timeouts against SQL Server

Description

This is an example to test timeouts against SQL Server.
The queries are artificially slowed down using a stored
procedure.

Warning: query takes 10 minutes to execute.

Erwin Kalvelagen, November 2006


Category : GAMS Data Utilities library


Main file : SQLServer.gms   includes :  SQLServer.gms

$onText

  This is an example to test timeouts against SQL Server.
  The queries are artificially slowed down using a stored
  procedure.

  Warning: query takes 10 minutes to execute.

  Erwin Kalvelagen, November 2006

$offText

$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"

$onEcho > populate.sql
use testdata
go
if exists (select name from sysobjects
         where name = 'slow' and type = 'P')
   drop procedure slow
if exists (select name from sysobjects
         where name = 'data' and type = 'U')
   drop table data
go
create table data(
i1 int,
i2 int,
x  real
)
go
insert into data values(1,1,2)
insert into data values(2,2,4)
go
select * from data
go
create proc slow @@DELAYLENGTH char(9)
as
begin
print 'delay:'+@@DELAYLENGTH
waitfor delay @@DELAYLENGTH
select * from data
end
go
exec slow '000:00:01'
go
$offEcho


$call =sqlcmd -S DUOLAP\SQLEXPRESS -i populate.sql



$onEcho > sql.txt
t2=700
c=Provider=MSDASQL;Driver={SQL Server};Server=DUOLAP\SQLEXPRESS;Database=testdata;Uid=gams;Pwd=gams;
q=exec slow '000:10:00'
o=output2.inc
$offEcho


$call sql2gms @sql.txt > %system.nullfile%;

parameter p(*,*) /
$include output2.inc
/;
display p;