MSSQL_OLEDB Problem
I'm using this plugin to run SQL script.
I'm able to logon to the server, but when after it I run
MSSQL_OLEDB::SQL_ExecuteScript /NOUNLOAD "$3"
my installer crash.
Any ideas why?
Archive: MSSQL_OLEDB Problem
MSSQL_OLEDB Problem
I'm using this plugin to run SQL script.
I'm able to logon to the server, but when after it I run
MSSQL_OLEDB::SQL_ExecuteScript /NOUNLOAD "$3"
my installer crash.
Any ideas why?
As written before, the script must contain only a SQL statement or, in other words, only one resource set is admitted.
If the script returns more than a result set, split it.
otherwise post the script and i'll check it
An update,
I did some testing with complex scripts (even with more than a statement, and everything works fine)
I did something like this:
MSSQL_OLEDB::SQL_Execute /NOUNLOAD "create database test"
MSSQL_OLEDB::SQL_Execute /NOUNLOAD "use test"
MSSQL_OLEDB::SQL_ExecuteScript /NOUNLOAD "$PLUGINSDIR\test.sql"
and test.sql is (copy and paste from MSSQL help online):
/* ************************** jobs table ************************** */
CREATE TABLE jobs
(
job_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
job_desc varchar(50) NOT NULL
DEFAULT 'New Position - title not formalized yet',
min_lvl tinyint NOT NULL
CHECK (min_lvl >= 10),
max_lvl tinyint NOT NULL
CHECK (max_lvl <= 250)
)
/* ***************** publishers table ******************** */
CREATE TABLE publishers
(
pub_id char(4) NOT NULL
CONSTRAINT UPKCL_pubind PRIMARY KEY CLUSTERED
CHECK (pub_id IN ('1389', '0736', '0877', '1622', '1756')
OR pub_id LIKE '99[0-9][0-9]'),
pub_name varchar(40) NULL,
city varchar(20) NULL,
state char(2) NULL,
country varchar(30) NULL
DEFAULT('USA')
)
/* ************************* employee table ************************* */
CREATE TABLE employee
(
emp_id char(8)
CONSTRAINT PK_emp_id PRIMARY KEY NONCLUSTERED
CONSTRAINT CK_emp_id CHECK (emp_id LIKE
'[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][FM]' or
emp_id LIKE '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][FM]'),
/* Each employee ID consists of three characters that
represent the employee's initials, followed by a five
digit number ranging from 10000 through 99999 and then the
employee's gender (M or F). A (hyphen) - is acceptable
for the middle initial. */
fname varchar(20) NOT NULL,
minit char(1) NULL,
lname varchar(30) NOT NULL,
job_id smallint NOT NULL
DEFAULT 1
/* Entry job_id for new hires. */
REFERENCES jobs(job_id),
job_lvl tinyint
DEFAULT 10,
/* Entry job_lvl for new hires. */
pub_id char(4) NOT NULL
DEFAULT ('9952')
REFERENCES publishers(pub_id),
/* By default, the Parent Company Publisher is the company
to whom each employee reports. */
hire_date datetime NOT NULL
DEFAULT (getdate())
/* By default, the current system date is entered. */
)