Insert script

I have a table called table1
Table1
INTID
MonthNo
Month
Year
QuarterName
ID
TRANS_GRP
Email
1
11
November
2014
Q4
11111
1742
[email protected]
2
12
December
2013
Q4
22222
1772
[email protected]
3
12
December
2014
Q3
33333
1472
[email protected]
I would like to insert data into table1 but the criteria should check if the table has email during that quarter and year, then  don't insert another data.
My current query is like below
SELECT DISTINCT
MONTH(Date_Assigned) AS
MonthNo,
DATENAME(MONTH, Date_Assigned) AS
Month,
YEAR(Date_Assigned) AS
Year,
'Q' + DATENAME(QUARTER,
[Date_Assigned]) AS QuarterName,
i.ID,
i.TRANS_GRP,
k.Email
FROM DB1.dbo.[Table2] i
WHERE NOT EXISTS(
SELECT 1 from [CBF].[dbo].[Table1]T1 WHERE T1.email=
k.Email and T1.QuarterName=
'Q' + DATENAME(QUARTER,
[Date_Assigned]) )
simam

If you're using SQL Server 2008 and up when I suggest to look into MERGE command. You will insert your data only in NOT MATCHED condition.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • How to get the insert scripts from a table data

    hi all,
    i want insert scripts for 100 records from a table.
    suppose i have a table xyz
    xyz:
    id name
    1 abc
    2 def
    i should get insert script for 100 rows like
    insert into xyz(id,name) values (1,'abc');
    insert into xyz(id,name) values (2,'def');
    i want 100 records data from all the tables from my database.
    thanks in advance to all.

    SQL> create table xyz (id number, name varchar2(10));
    Table created.
    SQL> insert into xyz values(1,'abc');
    1 row created.
    SQL> insert into xyz values(2,'def');
    1 row created.
    SQL> select 'insert into xyz values(id,name) values('||id||','''||name||''');' from xyz;
    'INSERTINTOXYZVALUES(ID,NAM
    insert into xyz values(id,name) values(1,'abc');
    insert into xyz values(id,name) values(2,'def');
    SQL>- - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Is there better way to write SQl Insert Script

    I am running out of ideas while working on one scenario and thought you guys would be able to guide me in right way.
    So, the scenario is I have a Table table1 table1(fieldkey, DisplayName, type) fieldkey - pkey   This table have n number of rows. The value of fieldkey in nth row is n. So if we have 1000 record, then the last row has a fieldkey = 1000.
    Below is my sample data.
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1001, 'COfficer',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1002, 'PData',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1003, 'EDate',100);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1004, 'PData',200);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1005, 'EDate',300);
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    (1006, 'Owner',400);This way of inserting the row with hardcoded value of fieldkey was creating the problem when the same table was used by other developer for their own new functionality.
    So, I thought of using the max(fieldkey) +1 from that table and use it in my insert script. This script file runs every time during software installation.
    I thought of using count to see if the row with same displaytype and type exists in that table or not. If exisits do not insert new row, if not insert new row.
    It looks like i will have to query the count statement everytime before I insert the row.
    select max(fieldkey) +1 into ll_fieldkey from table1
    select count(*) into ll_count from table1 where display ltrim(upper(name)) = 'COFFICER' and type =100)
    if ll_count >0 then
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    ( ll_fieldkey, 'COfficer',100);
    ll_fieldkey := ll_fieldkey +1
    end if;
    select count(*) into ll_count from table1 where display ltrim(upper(name)) = 'PData' and type =100)
    if ll_count >0 then
    Insert into table1 (FIELDKEY,DISPLAYNAME,TYPE) values
    ( ll_fieldkey, 'PData',100);
    ll_fieldkey := ll_fieldkey +1
    end if;
    ... and so on for all the insert statement. So, i was wondering if there is some better way to handle this situation of inserting the data.
    Thank you

    Hi !
    For check if the same display name and type already exists in table i would use Unique Key , but then again instead of if statement you should code some exception handlers. ... Hm .. Unque key is by may opinion better solution as
    codeing checks .
    For faster inserts that is , smaller code .. if there is no rules for values and the values are fixed , in any case you have to do this 100 inserts. If you can "calculate" values then maybe you can figure out some code .. but effect will be the same as hundred insert stetements one after another .. Procedure with this 100 inserts is not so bad solution.
    You can fill with values a nested table and then use forall ... save exceptions insert and with above mentioned UK , maybe this will be better.
    T
    Edited by: ttt on 10.3.2010 13:01

  • How to make an insert script for CLOB data types?

    I need to have an insert script for Oracle 11g where I insert large texts into a CLOB field
    I exported data from a source table using TOAD's export dataset and the insert statements option, so it generates a script of just simple insert into statements with the clob strings in the values clause within single quotes.
    While most of the inserts succeed, several fail with the error: string literal too long
    How can I insert long texts into clobs?
    One workaround I was considering, is maybe breaking up those inserts which are too big, so that it inserts a chunk, and then does an update to append additional chunks? not sure if that would work either
    first wanted to get any ideas from the oracle experts here in case there is a much easier, non-manual labor intensive way.

    Thank you for that informative link, Raj
    I wouldn't be able to use SQL Loader for this though, this is something that gets submitted to a DBA in a request and it must be in a script that can be run in Sql Plus, and it cannot pull it from a table or file.

  • Table Import Data - "Insert script" - National characters

    Hi all,
    it looks like that there is a problem with support of national characters in imported data file when method "Insert script" is chosen.
    Table -> Import Data -> Open datafile "csv".
    As far as in the preview window I'm seeing properly displayed national characters from csv data file and when I'm choosing "Insert" or "SQL Loader" method - data is properly imported to the table.
    But when I'm using "Insert script" method, in generated script national characters are changed into "bushes":
    http://imm.io/V0J9
    SQL Developer: Version 3.2.20.09
    OS: Windows XP SP3
    Client code page: WIN-1250
    Tested databases: 10g, 11g

    <p>This has been fixed in the latest build. The patch is now available for <a href = "http://www.oracle.com/technology/software/products/sql/index.html">download</a>.
    </p>
    Regards
    </p>Sue

  • SQL insert scripts generation from repository data xml file

    Hi All,
    I want to generate sql insert scripts from repository data xml file which contain <add-item>elements.
    Example: data xml file is contains
    <add-item item-descriptor="user" id="741">
    <set-property name="gender"><![CDATA[female]]></set-property>
    <set-property name="emailStatus"><![CDATA[__NULL__]]></set-property>
    <set-property name="receiveEmail"><![CDATA[__NULL__]]></set-property>
    <set-property name="email"><![CDATA[[email protected]]]></set-property>
    <set-property name="password"><![CDATA[a694cb1d6d011eddc444acb77338c1df6a22bac5de26330e2fe1d20f15f97ed6]]></set-property>
    <!-- rdonly derived <set-property name="abandonedOrderCount"><![CDATA[0]]></set-property> -->
    <set-property name="locale"><![CDATA[de_DE]]></set-property>
    <set-property name="userType"><![CDATA[1]]></set-property>
    <set-property name="autoLogin"><![CDATA[__NULL__]]></set-property>
    <set-property name="lastName"><![CDATA[Springford]]></set-property>
    <set-property name="member"><![CDATA[true]]></set-property>
    <set-property name="dateOfBirth"><![CDATA[7/18/1951 00:00:00]]></set-property>
    <!-- rdonly derived <set-property name="age"><![CDATA[61]]></set-property> -->
    <set-property name="registrationDate"><![CDATA[5/16/1996 00:00:00]]></set-property>
    <set-property name="login"><![CDATA[sally]]></set-property>
    <set-property name="lastActivity"><![CDATA[6/9/1999 00:00:00]]></set-property>
    <set-property name="homeAddress"><![CDATA[741]]></set-property>
    <set-property name="passwordSalt"><![CDATA[sally]]></set-property>
    <set-property name="generatedPassword"><![CDATA[__NULL__]]></set-property>
    <set-property name="firstName"><![CDATA[Sally]]></set-property>
    <set-property name="lastPasswordUpdate"><![CDATA[__NULL__]]></set-property>
    </add-item>
    Thanks
    Siva

    HI Rohan,
    Thanks for reply..
    I have checked the startSQLRepository script by using this we can export or import repository data from xml to repository.But in startSQLRepository there is no attribute to generate sql
    insert scripts from data xmls but there is a option to get the sql scripts(-ouputSQL).

  • DDL and INSERT scripts of EMPLOYEES, DEPARTMENTS, LOCATIONS, etc.

    Hi all,
    (Where) Can I have DDL and INSERT scripts of tables
    EMPLOYEES, DEPARTMENTS, LOCATIONS, JOB_HISTORY, JOBS, REGIONS,
    and
    EMP and DEPT tables?
    I could find only descriptions of the tables in http://download.oracle.com/docs/cd/B28359_01/server.111/b28328/scripts.htm#insertedID3, not the complete DDL and INSERT scripts. Please help.

    Hi,
    The scripts (and other files) are on the companion CD. You can download it from www.oracle.com .
    Bartek

  • Generating Insert Scripts for multiple tables

    Hi,
    I have 6 tables TABLA,TABLB,TABLC,TABLED,TABLEE,TABLEF
    I want to generate Insert Scripts for the above 6 tables.
    Is there any mechanism to do so so that i can generate the .sql files for the above 6 tables to another schema?
    Any help will be needful for me.

    Hi,
    May the below given function script help you...
    CREATE OR REPLACE FUNCTION get_insert_script (v_table_name VARCHAR2)
       RETURN VARCHAR2
    AS
       b_found   BOOLEAN         := FALSE;
       v_tempa   VARCHAR2 (8000);
       v_tempb   VARCHAR2 (8000);
       v_tempc   VARCHAR2 (255);
    BEGIN
       FOR tab_rec IN (SELECT table_name
                         FROM all_tables
                        WHERE table_name = UPPER (v_table_name))
       LOOP
          b_found := TRUE;
          v_tempa := 'select ''insert into ' || tab_rec.table_name || ' (';
          FOR col_rec IN (SELECT   *
                              FROM cols
                             WHERE table_name = tab_rec.table_name
                          ORDER BY column_id)
          LOOP
             IF col_rec.column_id = 1
             THEN
                v_tempa := v_tempa || '''||chr(10)||''';
             ELSE
                v_tempa := v_tempa || ',''||chr(10)||''';
                v_tempb := v_tempb || ',''||chr(10)||''';
             END IF;
             v_tempa := v_tempa || col_rec.column_name;
             IF INSTR (col_rec.data_type, 'CHAR') > 0
             THEN
                v_tempc := '''''''''||' || col_rec.column_name || '||''''''''';
             ELSIF INSTR (col_rec.data_type, 'DATE') > 0
             THEN
                v_tempc :=
                      '''to_date(''''''||to_char('
                   || col_rec.column_name
                   || ',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')''';
             ELSE
                v_tempc := col_rec.column_name;
             END IF;
             v_tempb :=
                   v_tempb
                || '''||decode('
                || col_rec.column_name
                || ',Null,''Null'','
                || v_tempc
                || ')||''';
          END LOOP;
          v_tempa :=
                v_tempa
             || ') values ('
             || v_tempb
             || ');'' from '
             || tab_rec.table_name
             || ';';
       END LOOP;
       IF NOT b_found
       THEN
          v_tempa := '- Table ' || v_table_name || ' not found';
       ELSE
          v_tempa := v_tempa || CHR (10) || 'select ''- commit;'' from dual;';
       END IF;
       RETURN v_tempa;
    END;(copied and pasted from a commercial site)
    *009*
    Edited by: 009 on Jan 14, 2010 10:43 PM
    (Function after debug)

  • How to generate the insert script of the  tables data present  in an entire

    How to generate the insert script of the tables data present in an entire schema in sqlplus environment
    with out toad can you please help me please!!!!!!!!!!!!!

    HI,
    First create this function to get insert scripts.
    /* Formatted on 2012/01/16 10:41 (Formatter Plus v4.8.8) */
    CREATE OR REPLACE FUNCTION extractdata (v_table_name VARCHAR2)
       RETURN VARCHAR2
    AS
       b_found   BOOLEAN         := FALSE;
       v_tempa   VARCHAR2 (8000);
       v_tempb   VARCHAR2 (8000);
       v_tempc   VARCHAR2 (255);
    BEGIN
       FOR tab_rec IN (SELECT table_name
                         FROM user_tables
                        WHERE table_name = UPPER (v_table_name))
       LOOP
          b_found := TRUE;
          v_tempa := 'select ''insert into ' || tab_rec.table_name || ' (';
          FOR col_rec IN (SELECT   *
                              FROM user_tab_columns
                             WHERE table_name = tab_rec.table_name
                          ORDER BY column_id)
          LOOP
             IF col_rec.column_id = 1
             THEN
                v_tempa := v_tempa || '''||chr(10)||''';
             ELSE
                v_tempa := v_tempa || ',''||chr(10)||''';
                v_tempb := v_tempb || ',''||chr(10)||''';
             END IF;
             v_tempa := v_tempa || col_rec.column_name;
             IF INSTR (col_rec.data_type, 'CHAR') > 0
             THEN
                v_tempc := '''''''''||' || col_rec.column_name || '||''''''''';
             ELSIF INSTR (col_rec.data_type, 'DATE') > 0
             THEN
                v_tempc :=
                      '''to_date(''''''||to_char('
                   || col_rec.column_name
                   || ',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')''';
             ELSE
                v_tempc := col_rec.column_name;
             END IF;
             v_tempb :=
                   v_tempb
                || '''||decode('
                || col_rec.column_name
                || ',Null,''Null'','
                || v_tempc
                || ')||''';
          END LOOP;
          v_tempa :=
                v_tempa
             || ') values ('
             || v_tempb
             || ');'' from '
             || tab_rec.table_name
             || ';';
       END LOOP;
       IF NOT b_found
       THEN
          v_tempa := '-- Table ' || v_table_name || ' not found';
       ELSE
          v_tempa := v_tempa || CHR (10) || 'select ''-- commit;'' from dual;';
       END IF;
       RETURN v_tempa;
    END;
    SET PAUSE OFF
    SET LINESIZE 1200
    SET PAGESIZE 100
    SET TERMOUT OFF
    SET HEAD OFF
    SET FEED OFF
    SET ECHO OFF
    SET VERIFY OFF
    SPOOL  GET_INSERTS.SP REP
    SELECT EXTRACTDATA('EMP') FROM DUAL;
    SPOOL OFF
    SET PAUSE  ON
    SET LINESIZE 120
    SET PAGESIZE 14
    SET TERMOUT ON
    SET HEAD ON
    SET FEED 5
    SET ECHO ON
    SET VERIFY ON
    SELECT    'insert into EMP ('
           || CHR (10)
           || 'EMPNO,'
           || CHR (10)
           || 'ENAME,'
           || CHR (10)
           || 'JOB,'
           || CHR (10)
           || 'MGR,'
           || CHR (10)
           || 'HIREDATE,'
           || CHR (10)
           || 'SAL,'
           || CHR (10)
           || 'COMM,'
           || CHR (10)
           || 'DEPTNO) values ('
           || DECODE (empno, NULL, 'Null', empno)
           || ','
           || CHR (10)
           || ''
           || DECODE (ename, NULL, 'Null', '''' || ename || '''')
           || ','
           || CHR (10)
           || ''
           || DECODE (job, NULL, 'Null', '''' || job || '''')
           || ','
           || CHR (10)
           || ''
           || DECODE (mgr, NULL, 'Null', mgr)
           || ','
           || CHR (10)
           || ''
           || DECODE (hiredate,
                      NULL, 'Null',
                         'to_date('''
                      || TO_CHAR (hiredate, 'mm/dd/yyyy hh24:mi')
                      || ''',''mm/dd/yyyy hh24:mi'')'
           || ','
           || CHR (10)
           || ''
           || DECODE (sal, NULL, 'Null', sal)
           || ','
           || CHR (10)
           || ''
           || DECODE (comm, NULL, 'Null', comm)
           || ','
           || CHR (10)
           || ''
           || DECODE (deptno, NULL, 'Null', deptno)
           || ');'
      FROM emp;
    SELECT '-- commit;'
      FROM DUAL;now run the baove select statement you will get the following insert statements
    /* Formatted on 2012/01/16 10:57 (Formatter Plus v4.8.8) */
    --'INSERT INTO EMP('||CHR(10)||'EMPNO,'||CHR(10)||'ENAME,'||CHR(10)||'JOB,'||CHR(10)||'MGR,'||CHR(10)||'HIREDATE,'||CHR(10)||'SAL,'||CHR(10)||'COMM,'||CHR(10)||'DEPTNO)VALUES('||DECODE(EMPNO,NULL,'NULL',EMPNO)||','||CHR(10)||''||DECODE(ENAME,NULL,'NULL',''''|
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm, deptno
         VALUES (7369, 'SMITH', 'CLERK', 7902,
                 TO_DATE ('12/17/1980 00:00', 'mm/dd/yyyy hh24:mi'), 800, NULL, 20
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm, deptno
         VALUES (7499, 'ALLEN', 'SALESMAN', 7698,
                 TO_DATE ('02/20/1981 00:00', 'mm/dd/yyyy hh24:mi'), 1600, 300, 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm, deptno
         VALUES (7521, 'WARD', 'SALESMAN', 7698,
                 TO_DATE ('02/22/1981 00:00', 'mm/dd/yyyy hh24:mi'), 1250, 500, 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7566, 'JONES', 'MANAGER', 7839,
                 TO_DATE ('04/02/1981 00:00', 'mm/dd/yyyy hh24:mi'), 2975, NULL,
                 20
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7654, 'MARTIN', 'SALESMAN', 7698,
                 TO_DATE ('09/28/1981 00:00', 'mm/dd/yyyy hh24:mi'), 1250, 1400,
                 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7698, 'BLAKE', 'MANAGER', 7839,
                 TO_DATE ('05/01/1981 00:00', 'mm/dd/yyyy hh24:mi'), 2850, NULL,
                 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7782, 'CLARK', 'MANAGER', 7839,
                 TO_DATE ('06/09/1981 00:00', 'mm/dd/yyyy hh24:mi'), 2450, NULL,
                 10
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7788, 'SCOTT', 'ANALYST', 7566,
                 TO_DATE ('04/19/1987 00:00', 'mm/dd/yyyy hh24:mi'), 3000, NULL,
                 20
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7839, 'KING', 'PRESIDENT', NULL,
                 TO_DATE ('11/17/1981 00:00', 'mm/dd/yyyy hh24:mi'), 5000, NULL,
                 10
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm, deptno
         VALUES (7844, 'TURNER', 'SALESMAN', 7698,
                 TO_DATE ('09/08/1981 00:00', 'mm/dd/yyyy hh24:mi'), 1500, 0, 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7876, 'ADAMS', 'CLERK', 7788,
                 TO_DATE ('05/23/1987 00:00', 'mm/dd/yyyy hh24:mi'), 1100, NULL,
                 20
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm, deptno
         VALUES (7900, 'JAMES', 'CLERK', 7698,
                 TO_DATE ('12/03/1981 00:00', 'mm/dd/yyyy hh24:mi'), 950, NULL, 30
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7902, 'FORD', 'ANALYST', 7566,
                 TO_DATE ('12/03/1981 00:00', 'mm/dd/yyyy hh24:mi'), 3000, NULL,
                 20
    INSERT INTO emp
                (empno, ename, job, mgr,
                 hiredate, sal, comm,
                 deptno
         VALUES (7934, 'MILLER', 'CLERK', 7782,
                 TO_DATE ('01/23/1982 00:00', 'mm/dd/yyyy hh24:mi'), 1300, NULL,
                 10
                );i hope this helps .
    Thanks,
    P Prakash
    Edited by: prakash on Jan 15, 2012 9:21 PM
    Edited by: prakash on Jan 15, 2012 9:22 PM

  • Insert Scripts

    Hi all,
    i need to insert into one table based on cursor fetching values.
    For example, if cursor value is fetching below values:
    A
    B
    C.
    based on above values (A,B &C) ,
    i need to insert into table in single block like below
    values A = 'AA'
    B = 'BB'
    Help me how to write insert script .......
    Regards,
    PAP

    Perhaps I missunderstand your requirements, but I think you simply could change your cursor in
    select <yourcolumn>||<yourcolumn> from <yourtable>;Alternatively you could change the insert statement:
    insert into <destination-table> (<destination_column>)
    values (<yourrecord>.<field>||<yourrecord>.<field>);Edited by: hm on 26.10.2011 23:35

  • Creating insert Script

    Hi,
    I am using SQL developer to generate insert scripts for data in the table. Insert script is not generated properly for tables having columns of type "OBJECT"
    Is there any other solutions to take scripts for tables with data type "Object"
    Regards
    Sugirtha

    You can't just make the script up on ur own? U just want the correct syntax for inserting data right?
    -Tim

  • INSERT Script stored as "SQL Statement Script" not firing on Oracle Alert

    We are using Alert Manager to run Alerts based on absence information in EBS R12.1.3 HR tables.
    Application: Human Resources
    Period/Event: Periodic
    Frequency: Every Day
    The Alert has 2 actions.
    One is to email a supervisor based on the Alert SQL finding staff who have had x number of absences over a set period of time.
    That is working fine.
    The other action is defined as an "SQL Statement Script".
    The SQL script inserts the variables defined in the SQL from the main Alert definition SQL, into a custom table.
    When the Alert fires, we are getting the email generated, but the INSERT statement isn't firing.
    However, when we look at the result of the Alert when it has run, and look at the steps which were fired, we can see the email step and the SQL step. When we look at the SQL in the SQL step which was generated, we can copy and paste it direct into TOAD and it works fine.
    We have tried a simple SQL INSERT statement which even just does:
    INSERT INTO xx_tmp (VALUE1_DATE, VALUE2) VALUES (SYSDATE, 'this');
    But even that does not work.
    We wonder if the issue is that we cannot do a direct INSERT from an alert type of "SQL Statement Script"?
    We have found another Alert which does a direct UPDATE on a table, but the SQL Statement Script definition has "Purchasing" as the Application, because it's updating a PO table.
    In our case, we're trying to insert into a custom table held in our in-house XX schema.
    Could the problem be that we don't have the "Application" set? If that's the case, we don't have a corresponding application anyway.
    Or can we not do a direct INSERT like this - do we need to use a package instead, and call that?
    Any advice much appreciated.
    Thanks

    Hi Brian,
    Alert issue - Custom SQL fix
    1. Define actions via "Actions" button on Alert Definition
    2. Create an action for e.g. "Send Message to Supervisor"
       Action type: message
       Action - sends email to people
    3. Create another action called e.g. "Insert Record"
       Action type: SQL Statement Script
       Fill in SQL in the "Text" section, no need to add a begin or end bit, just a simple INSERT INTO X etc ending with a semi colon
    4. Back on the main alert definition window, go to "Action Sets" button
       Here, need one SEQ for the Message / Email (e.g. Seq 1), and then click on "Action Set Details" and click on "Members" tab and select the "Send Message to Supervisor" Action
       Then close the "Action Set Details" window, and return to the "Action Sets" window
       click into 2nd line, add e.g. Seq 2, and call it e.g. "Insert Record", click on "Action Set Details" > Members tab and select the "Insert Record" The problem was that in the first instance, we had a single Action Set, and under "Members" had selected the "Send Message to Supervisor" and "Insert Record" at the same time.
    Short answer: each Action needs to be defined as a separate line in the Action Sets definition.
    I can send screenshots if you need them, and don't mind putting your email address on this forum.
    You can always edit the thread after I've emailed you, to remove your email address.

  • Insert Script Object?

    In Acrobat Pro you can create a document script as follows:
    function Hello()
    app.alert("Hello World")
    And call this Hello.
    If you create button on the page then create an action on Mouse Up Run a JavaScript which looks like this:
    Hello();
    A message box appears saying Hello World click OK and press the button and it keeps coming back.
    Now in Designer this is a little different.
    I create a new page, insert a script object rename it to Hello and type:
    function Hello()
    app.alert("Hello World")
    I then create a button and on the mouse up action type;
    Hello();
    If I try this I get the following mesaage:
    TypeError: Hello is not a function
    1:XFA:form1[0]:#subform[0]:Button1[0]:mouseUp
    Why is it so?
    Even removing the script object and going to the Form properties Variables tab and entering the function script there does not seem to work.

    Thanks Steve,
    It works without a hitch. Im still getting my head around JavaScript and 2 weeks, 6 hours a day of reading and testing and reading is slowly getting clearer I think.
    Just to make sure Im getting this clear in my head. The way I had the script before was when it was applied to the field that showed the value it was referring to this as the field itself. So it worked not worries because it was point to the itself.
    When I tried to apply the same script in a script object field (variables) that the whole documents can reference it was only in as a variable. The line form1.variables.setTotals.Totals(); did not do anything because it did not see the totals as a function and refer to it, and as a result nothing would appear in the filed. By adding obj to the script it tells the form that its an object and the objects formula is spei1 + spei2. This now means that the script can be applied to any filed and that is where form1.variables.setTotals.Totals(this); comes in. It tells the filed apply the object (Totals [spei1 + spei2] ) to this filed.
    Does this mean that any script placed in the Variables field needs to be referred to as objects?
    The reason I was taking this approach was to resolve a problem posted earlier.
    I thought by having the script as a script object that was applied to the document rather than the field it would update the other fields that refer to it. Which I now realize will not happen. Could you suggest a conditional statement that I could put in to:
    If special item 1 = $12.00 the result in the total = $12.00. If I then click on one of the fields in the special column say in Monday for example the result should be $12.00. If I then decide to enter another $12.00 in special item 2 the total will now be $24.00 but the Monday result will still say $12.00.
    Is there a way to have it check that it the figure which may appear in the Special column, to update that result as well?
    Should I be look at a message box instead telling the user there is a difference and for them to re-click on the Monday field to update it?
    Any suggestions would be appreciated.
    Regards, John.

  • Inserting Script code into HTML - possibly using snippets?

    I am using Robohelp 7 and I need to insert some tracking script code into the HTML.
    The location needs to be right before the body close code.
    I have multiple pages and would love to use a snippet so that it would be easy to update as necessary.
    When I create the snippet code and drop it on the design page, it shows the code.
    I cannot get it to drop into the HTML.  Any suggestions?
    If it can't be done with snippets, is there a way to mass import code into the HTML of ALL pages?  I'm talking hundreds of pages.

    Hi there
    I doubt you will want to use snippets for this. Why? Well, if you use Snippets, you will need to edit all your pages so they include the snippet!
    So here's how I might approach it.
    Open the Project Set-up pod. Create a Topic Template. Inside the Template, add a Footer. Insert the script into the footer. Save the template and apply it to all your topics. You do this by selecting all topics in the Topic List pod, right-clicking them and choosing the Template. Whoosh! The template is associated and all topics now have a footer (with the script inside).
    Hopefully this helps... Rick
    Begin learning RoboHelp HTML 7 within the day - $24.95!
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Inserting script into iWeb

    Anyone know how I can insert a javascript command into my iWeb page? My teamspeak provider gives me a script,but I'm not sure how to insert it.

    So it sounds like this code snippet will display something on the page. In that case, you will need to follow the "standard" steps to add external HTML code into your page. Here is a thread where I have gone through the process in steps. The thread is actually about adding an ad banner, but the steps and principles are the same: Reserve space on the page in iWeb, then find the space in the published HTML file and replace it with your code. Here's the link....
    http://discussions.apple.com/thread.jspa?messageID=2446855&#2446855
    If you have any questions, please don't hesitate to post them here. Good luck!

  • How to insert script?

    I am trying to figure out how to insert a script into my iWeb page -- the source says to cut and paste the text below, but it doesn't work, it just pastes as text, not as a working script. help! Thanks
    <script type="text/javascript"
    src="http://www.hebcal.com/shabbat/?geo=zip;zip=59801;m=72;cfg=j">
    </script>
    <noscript>
    <!-- this link seen by people who have JavaScript turned off -->
    Shabbat
    Candle Lighting times for Missoula, MT 59801
    courtesy of hebcal.com.
    </noscript>

    swei0009:
    Welcome to the Apple Discussions. You'll have to do that post-publishing. After you've published to your .Mac account or to a folder if you're using another server you'll have to locate the html file for the page you want to enter the code and open it with a text editor and enter the text. I'm not sure where this would be entered in the page but possible just before the < / body> tag. You can go to Varkgirls iWeb FAQ site for more info. - http://www.varkgirl.com/Varkgirl/Home.html
    Do you Twango?

Maybe you are looking for