Script Help

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Warlock
DBB 3D Artist
DBB 3D Artist
Posts: 3370
Joined: Wed May 12, 1999 2:01 am
Location: Midland, Tx, U.S.
Contact:

Script Help

Post by Warlock »

ok im trying to do a script that will put a number out of a reg file and insert it and build a sql script.

will i got all that figured out but my problem is the sql script needs to have blank lines in it

heres my script

MarkID.bat
_________________________________________

C:\\tools\\BuildRegFromTemplate.exe c:\\tools\\OfficeID.dat c:\\tools\\Siteid.txt

findstr \"SITEID\" c:\\tools\\siteid.txt > c:\\tools\\siteid2.txt

c:\\tools\\cut -c11-13 c:\\tools\\siteid2.txt > c:\\tools\\StoreNum.txt

del c:\\tools\\siteid.txt /q
del c:\\tools\\siteid2.txt /q

set /P storeid=<c:\\tools\\StoreNum.txt
FOR /f %%i in (\"%storeid%\") do set storeid=%%i

del c:\\temp\\storenum.txt

Echo INSERT INTO EMPLOYEE >> c:\\office\\db\\upgs\\upg.000
(EMPNO,HIREDATE,PROFILE,JOBCLASS,FULLNAME,POSACCESS,ACCOUNT_ID,STATUS,TEL1,SOCIALSEC,EXTERNAL_CODE,SITE_ID,ADDITIONALINCOME,ISBELONGTOHOST,ISSENDTOHOST,USERNAME,POSPASSWORD,EMPINITIALS,EMPCOLOR_RGB) >> c:\\office\\db\\upgs\\upg.000
Echo VALUES >> c:\\office\\db\\upgs\\upg.000
Echo (50,'08/07/2009',1,61300,'Marketing',1,0,'F','(432)580-8850',999988777,50,%storeid%,'F','F','F',50,9876,'Mar',0) >> c:\\office\\db\\upgs\\upg.000

Echo INSERT INTO EMPLOYEEJOB >> c:\\office\\db\\upgs\\upg.000
Echo (EMPLOYEE_ID,JOBCLASS_ID,HOUR_COST,JOB_STATUS) >> c:\\office\\db\\upgs\\upg.000
Echo VALUES >> c:\\office\\db\\upgs\\upg.000
Echo (50,61300,0,'E') >> c:\\office\\db\\upgs\\upg.000

Echo INSERT INTO EMPSITE >> c:\\office\\db\\upgs\\upg.000
Echo (EMP_ID,SITE_ID) >> c:\\office\\db\\upgs\\upg.000
Echo VALUES >> c:\\office\\db\\upgs\\upg.000
Echo (50,%storeid%) >> c:\\office\\db\\upgs\\upg.000

Echo INSERT INTO USERMENU >> c:\\office\\db\\upgs\\upg.000
Echo (USERID,MENUID) >> c:\\office\\db\\upgs\\upg.000
Echo VALUES >> c:\\office\\db\\upgs\\upg.000
Echo (50,2) >> c:\\office\\db\\upgs\\upg.000

Echo $$RUN UTIL_EncryptEmpPasswords$$ >> c:\\office\\db\\upgs\\upg.000

Call c:\\office\\exe\\dbupgrader.exe
___________________________________________________

ok that part works good but the problem im having is when it makes the upg.000 file it makes it like this.

__________________________________________________
INSERT INTO EMPLOYEE
(EMPNO,HIREDATE,PROFILE,JOBCLASS,FULLNAME,POSACCESS,ACCOUNT_ID,STATUS,TEL1,SOCIALSEC,EXTERNAL_CODE,SITE_ID,ADDITIONALINCOME,ISBELONGTOHOST,ISSENDTOHOST,USERNAME,POSPASSWORD,EMPINITIALS,EMPCOLOR_RGB)
VALUES
(50,'08/07/2009',1,61300,'Marketing',1,0,'F','(432)580-8850',999988777,50,218,'F','F','F',50,9876,'Mar',0)
INSERT INTO EMPLOYEEJOB
(EMPLOYEE_ID,JOBCLASS_ID,HOUR_COST,JOB_STATUS)
VALUES
(50,61300,0,'E')
INSERT INTO EMPSITE
(EMP_ID,SITE_ID)
VALUES
(50,218)
INSERT INTO USERMENU
(USERID,MENUID)
VALUES
(50,2)
$$RUN UTIL_EncryptEmpPasswords$$
___________________________________________________

The problem there needs to be a blank line before eatch INSERT command or it thinks its one script when its really 5 seperate scrips its needs to look like this.

___________________________________________________

INSERT INTO EMPLOYEE
(EMPNO,HIREDATE,PROFILE,JOBCLASS,FULLNAME,POSACCESS,ACCOUNT_ID,STATUS,TEL1,SOCIALSEC,EXTERNAL_CODE,SITE_ID,ADDITIONALINCOME,ISBELONGTOHOST,ISSENDTOHOST,USERNAME,POSPASSWORD,EMPINITIALS,EMPCOLOR_RGB)
VALUES
(50,'08/07/2009',1,61300,'Marketing',1,0,'F','(432)580-8850',999988777,50,218,'F','F','F',50,9876,'Mar',0)

INSERT INTO EMPLOYEEJOB
(EMPLOYEE_ID,JOBCLASS_ID,HOUR_COST,JOB_STATUS)
VALUES
(50,61300,0,'E')

INSERT INTO EMPSITE
(EMP_ID,SITE_ID)
VALUES
(50,218)

INSERT INTO USERMENU
(USERID,MENUID)
VALUES
(50,2)

$$RUN UTIL_EncryptEmpPasswords$$
____________________________________________________

is there a way to add the blank lines in? please please help this one has me stuck.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

pick a better tool guy.

Tho protip: SQL statements are terminated by a semi-colon.
User avatar
Warlock
DBB 3D Artist
DBB 3D Artist
Posts: 3370
Joined: Wed May 12, 1999 2:01 am
Location: Midland, Tx, U.S.
Contact:

Post by Warlock »

i wish i could use better tools but i cant install any other apps on the sotore servers.
Post Reply