Create trigger if referenced column from other db not exists

I have such scenario: there are two databases DB1 and DB2.
DB1 has table MyTable and new column was added NewCol.
On the DB2 table a trigger was created that updates DB1.MyTable.NewCol.
Both scripts generated by SSDT are correct but the problem is during deployment. I have an automation tool which executes publish scripts in a predefined order. In this case DB2 is executed first and the scripts fails because referenced column from DB1 doesn't
exist yet.
Do you have any idea how to overcome this issue? Off course I could change an order in which scripts are executed and create DB1 before DB2. But in other scenario I could have a cross reference dependency and I am afraid there is no use for SSDT in such
case.

I found a workaround. The solution is to handle it manually in an pre-deployment script.
In this scenario I added pre-deployment script for DB2 to check if new column exists in DB1 and if not then create it.
IF (OBJECT_ID('ATC.dbo.tblDisplayStatusOverview') IS NOT NULL)
BEGIN
    PRINT 'Checking if columns exists ATC.tblDisplayStatusOverview.IPAddress...'
    IF (COL_LENGTH('ATC.dbo.tblDisplayStatusOverview', 'IPAddress') IS NULL)
    BEGIN
        PRINT 'Adding column ATC.tblDisplayStatusOverview.IPAddress...'
        ALTER TABLE ATC.dbo.tblDisplayStatusOverview
            ADD [IPAddress] VARCHAR (15)  NULL;
    END    
END

Similar Messages

  • Problem creating a datablock with columns from 2 tables...

    Hello guys, i have a problem in creating a datablock with columns from 2 different tables. I try to create the datalock manually and in the Query Data Source Type Property i choose FROM clause query, and in the query data source name property i type my sql statement with the columns i want to display.After that i place the items that the datablock will contain , manually from the painter. However , when i run the application, the datablock doesn't display the items from the database. Am i doing something wrong?
    Thanx in advance,
    Regards,
    Bill.

    Never mind Peter, I found the error. I forgot to make execute_query for the datablock, so this was the reason why the items weren't displayed to me.
    Thanx anyway a lot for your advices and your time you spent !

  • VENDOR is mapped to the dialog column (USAGE_VENDOR) that does not exist

    Hello,
    I'm trying to install Solman 4.0 Unicode.  When I start sapinst and select a Central System, I get an error before it even gets to the point where I can input some parameters.  The error is below, has anyone experienced this?  Thank you.
    ~TJ
    ERROR      2006-08-17 09:29:20 [iaxxctbctl.cpp:128]
               CTableControl::retrieveDefaultValue
    FGE-00003  The key db column VENDOR is mapped to the dialog column (USAGE_VENDOR) that does not exist.
    TRACE      [iaxxejsbas.hpp:388]
               handleException<ESAPinstException>()
    Converting exception into JS Exception Exception.
    ERROR      2006-08-17 09:29:20
               CJSlibModule::writeError_impl()
    MUT-03025  Caught ESAPinstException in Modulecall: ESAPinstException: error text undefined.
    TRACE      [iaxxejsbas.hpp:460]
               EJS_Base::dispatchFunctionCall()
    JS Callback has thrown unknown exception. Rethrowing.
    ERROR      2006-08-17 09:29:20
    FCO-00011  The step selectUsages with step key |NW_Onehost|ind|ind|ind|ind|0|0|SAP_Software_Features|ind|ind|ind|ind|5|0|SAP_Software_Features_Select|ind|ind|ind|ind|1|0|selectUsages was executed with status ERROR .
    TRACE     
    <html><head></head><body><p>An error occurred while processing service <b>SAP Solution Manager 4.0 > SAP Systems > IBM DB2 UDB for iSeries > Central System > Central System Installation</b>. You may now</p><ul> <li>press <I>Retry</I> to repeat the current step.</li> <li>press the <I>View Log</I> button to get more information about the error.</li> <li>stop the task and continue with it later.</li></ul><p>Log files are written to <b>G:\usr\sap/SAPinst/SOLMAN/SYSTEM/DB4/CENTRAL/AS</b>.</p></body></html>
    TRACE      [iaxxgenimp.cpp:1093]
               showDialog()
    waiting for an answer from gui
    INFO       2006-08-17 09:32:31 [iaxxgenimp.cpp:779]
               showDialog()
    An error occured and the user decide to stop.\n Current step "|NW_Onehost|ind|ind|ind|ind|0|0|SAP_Software_Features|ind|ind|ind|ind|5|0|SAP_Software_Features_Select|ind|ind|ind|ind|1|0|selectUsages".

    FYI - I was using the NW2004s control file patch not NW2004sSR1.  Once using the correct control files it worked.
    ~TJ

  • Create Trigger to insert records from one table to another

    I created the below trigger to move data from one table to another after records have been inserted from another table to that table. What I need done is that each time records have been inserted into TEST_TBL, one of these actions codes should be implimented: U-update, N-insert, D-delete and inserted into TEST_TBL1. But each time I run the script, I get bunch of errors. Please see the script below: - Your help will be appreciated.
    create or replace
    trigger POWER_tr
    after update or insert or delete ON test_tbl
    for each row
    begin
    if updating then
    insert into test_tbl1
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, action_code, date_added
    VALUES
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, 'U', sysdate);
    ELSif INSERTING then
    insert insert into test_tbl1
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, action_code, date_added
    VALUES
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, 'N', sysdate);
    ELSIF deleting then
    insert into test_tbl1
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, action_code, date_added
    VALUES
    (idx, mke, ctl, ori, nam, sex, rac, pob, dob, hgt, 'D', sysdate);
    END IF;
    END POWER_tr;
    Thank you,
    Albert Zaza
    Edited by: azaza on Mar 1, 2009 4:14 PM

    Hello
    At the end of trigger show errors / and post what errors are you getting exactly?
    Here is a simple example for your reference, this will save old values in history table; you can replace it with new values if that's what do you want.
    CREATE OR REPLACE TRIGGER TRG_DU
       AFTER DELETE OR UPDATE
       ON EMPLOYEE    REFERENCING NEW AS New OLD AS Old
       FOR EACH ROW
    DECLARE
    BEGIN
       IF UPDATING
       THEN
          INSERT INTO employee_hist
            VALUES   ('UPDATE',
                      :OLD.empid,
                      :OLD.name,
                      :OLD.deptid);
       ELSIF DELETING
       THEN
          INSERT INTO employee_hist
            VALUES   ('UPDATE',
                      :OLD.empid,
                      :OLD.name,
                      :OLD.deptid);
       END IF;
    EXCEPTION
       WHEN OTHERS
       THEN
          -- Consider logging the error and then re-raise
          RAISE;
    END TRG_DU;
    /Regards
    Edited by: OrionNet on Mar 1, 2009 7:27 PM

  • It is not working when use trigger to check data from other table.

    Please help me with this, I have put a trigger on a table but it can not work as I expect.
    case study: one class has many students, only one of them goes to match.
    The purpose of this trigger is to check when choose a student goes to match, this student must in his class where he belongs to.
    Version of Oracle is 10.2.0.1.0.
    --table:
    DROP TABLE STU;
    DROP TABLE CLASS;
    create table CLASS(
    CID     VARCHAR2(5)   PRIMARY KEY,
    CNAME   VARCHAR2(20)  NOT NULL,
    SCHOSEN VARCHAR2(5));
    create table STU(
    SID     VARCHAR2(5)   PRIMARY KEY,
    SNAME   VARCHAR2(20)  NOT NULL,
    CID     VARCHAR2(5)   NOT NULL REFERENCES CLASS(CID) ON DELETE CASCADE);
    --data:
    --CLASS
    INSERT INTO CLASS(CID,CNAME) VALUES(1,'SUN');
    INSERT INTO CLASS(CID,CNAME) VALUES(2,'MOON');
    INSERT INTO CLASS(CID,CNAME) VALUES(3,'EARTH');
    --STU
    INSERT INTO STU VALUES(1,'JACK',1);
    INSERT INTO STU VALUES(2,'TOM',1);
    INSERT INTO STU VALUES(3,'LILY',2);
    INSERT INTO STU VALUES(4,'DUSTIN',3);
    --TRIGGER
    CREATE OR REPLACE TRIGGER CHECK_SCHOSEN
    BEFORE INSERT OR UPDATE OF SCHOSEN ON CLASS
    FOR EACH ROW WHEN (NEW.SCHOSEN IS NOT NULL)
    DECLARE
    DUMMY INTEGER;
    INVALID_STU EXCEPTION;
    VALID_STU EXCEPTION;
    MUTATING_TABLE EXCEPTION;
    PRAGMA EXCEPTION_INIT(MUTATING_TABLE, -4091);
    CURSOR DUMMY_CURSOR (ST VARCHAR2, CL VARCHAR2) IS
      SELECT SID FROM STU, CLASS
      WHERE STU.SID=ST AND STU.CID=CLASS.CID AND CLASS.CID=CL
        FOR UPDATE OF CLASS.SCHOSEN;
    BEGIN
      OPEN DUMMY_CURSOR(:NEW.SCHOSEN, :NEW.CID);
      FETCH DUMMY_CURSOR INTO DUMMY;
      IF DUMMY_CURSOR%NOTFOUND THEN
        RAISE INVALID_STU;
      ELSE
        RAISE VALID_STU;
      END IF;
      CLOSE DUMMY_CURSOR;
    EXCEPTION
      WHEN INVALID_STU THEN
        CLOSE DUMMY_CURSOR;
        DBMS_OUTPUT.PUT_LINE('PLEASE RE-ENTER CLASS ID AND STUDENT ID AS CLASS OR STUDENT IS NOT VALID.');
      WHEN VALID_STU THEN
        CLOSE DUMMY_CURSOR;
        DBMS_OUTPUT.PUT_LINE('STUDENT CHOOSE SUCCEFULLY!');
      WHEN MUTATING_TABLE THEN
        NULL;
    END;
    /Just copy and paste above and try to run following:
    UPDATE CLASS
    SET SCHOSEN=3
    WHERE CID=1;
    Clearly,you can not choose student which is 3 as match member of class 1. Please help me. Thanks.
    Edited by: 991096 on 01-Mar-2013 02:36
    Edited by: 991096 on 01-Mar-2013 03:03
    Edited by: 991096 on 01-Mar-2013 03:11

    Hi,
    Welcome to the forum!
    Like the others, I can't see a business purpose for this trigger. I assume it's just an experiment to learn how triggers work.
    991096 wrote:
    Please help me with this, I have put a trigger on a table but it can not be triggered.Sorry, I don't understand what you want help with.
    Are you saying the trigger doesn't fire? It does fire; it just raises the mutating table error, so you don't see anything.
    case study: one class has many students, only one of them goes to match.What do you mean when you say "goes to match"?
    --table:
    DROP TABLE STU;
    DROP TABLE CLASS;
    create table CLASS(
    CID VARCHAR2(5) PRIMARY KEY,
    CNAME VARCHAR2(20) NOT NULL,
    SCHOSEN VARCHAR2(5));
    create table STU(
    SID VARCHAR2(5) PRIMARY KEY,
    SNAME VARCHAR2(20) NOT NULL,
    CID VARCHAR2(5) NOT NULL REFERENCES CLASS(CID) ON DELETE CASCADE);
    --data:
    --CLASS
    INSERT INTO CLASS(CID,CNAME) VALUES(1,'SUN');
    INSERT INTO CLASS(CID,CNAME) VALUES(2,'MOON');
    INSERT INTO CLASS(CID,CNAME) VALUES(3,'EARTH');
    --STU
    INSERT INTO STU VALUES(1,'JACK',1);
    INSERT INTO STU VALUES(2,'TOM',1);
    INSERT INTO STU VALUES(3,'LILY',2);
    INSERT INTO STU VALUES(4,'DUSTIN',3);
    --TRIGGER
    CREATE OR REPLACE TRIGGER CHECK_SCHOSEN
    BEFORE INSERT OR UPDATE OF SCHOSEN ON CLASS
    FOR EACH ROW WHEN (NEW.SCHOSEN IS NOT NULL)
    DECLARE
    DUMMY INTEGER;
    INVALID_STU EXCEPTION;
    VALID_STU EXCEPTION;
    MUTATING_TABLE EXCEPTION;
    PRAGMA EXCEPTION_INIT(MUTATING_TABLE, -4091);
    CURSOR DUMMY_CURSOR (ST VARCHAR2, CL VARCHAR2) IS
    SELECT SID FROM STU, CLASS
    WHERE STU.SID=ST AND STU.CID=CLASS.CID AND CLASS.CID=CL
    FOR UPDATE OF CLASS.SCHOSEN;
    BEGIN
    OPEN DUMMY_CURSOR(:NEW.SCHOSEN, :NEW.CID);
    FETCH DUMMY_CURSOR INTO DUMMY;
    IF DUMMY_CURSOR%NOTFOUND THEN
    RAISE INVALID_STU;
    ELSE
    RAISE VALID_STU;
    END IF;
    CLOSE DUMMY_CURSOR;
    EXCEPTION
    WHEN INVALID_STU THEN
    CLOSE DUMMY_CURSOR;
    DBMS_OUTPUT.PUT_LINE('PLEASE RE-ENTER CLASS ID AND STUDENT ID AS CLASS OR STUDENT IS NOT VALID.');
    WHEN VALID_STU THEN
    CLOSE DUMMY_CURSOR;
    DBMS_OUTPUT.PUT_LINE('STUDENT CHOOSE SUCCEFULLY!');
    WHEN MUTATING_TABLE THEN
    NULL;
    END;
    /Thanks for posting the CREATE TABLE, INSERT and CREATE TRIGGER statements; that really helps!
    See the forum FAQ {message:id=9360002} for other helpful tips, such as how to use \ tags to post formatted code.
    Just copy and paste above and try to run following:
    UPDATE CLASS
    SET SCHOSEN=3
    WHERE CID=1;
    Clearly,you can not choose student which is 3 as match member of class 1. The trigger did not be triggered. Please help me. Thanks.You can't do DML, or even query, the class table from a FOR EACH ROW trigger on the same class table.
    Add 3 more calls to put_line to see this:CREATE OR REPLACE TRIGGER CHECK_SCHOSEN
    BEFORE INSERT OR UPDATE OF SCHOSEN ON CLASS
    FOR EACH ROW WHEN (NEW.SCHOSEN IS NOT NULL)
    DECLARE
    DUMMY          INTEGER;
    INVALID_STU      EXCEPTION;
    VALID_STU          EXCEPTION;
    MUTATING_TABLE      EXCEPTION;
    PRAGMA           EXCEPTION_INIT (MUTATING_TABLE, -4091);
    CURSOR DUMMY_CURSOR (ST VARCHAR2, CL VARCHAR2) IS
    SELECT SID
         FROM      STU
         ,     CLASS
         WHERE     STU.SID          = ST
         AND     STU.CID          = CLASS.CID
         AND     CLASS.CID     = CL
         FOR UPDATE OF           CLASS.SCHOSEN;
    BEGIN
    dbms_output.put_line (:NEW.schosen || ' = schosen entering check_schosen');     -- ***** NEW *****
    OPEN DUMMY_CURSOR (:NEW.SCHOSEN, :NEW.CID);
    dbms_output.put_line ('Cursor is open now.');     -- ***** NEW *****
    FETCH DUMMY_CURSOR INTO DUMMY;
    IF DUMMY_CURSOR%NOTFOUND THEN
    RAISE INVALID_STU;
    ELSE
    RAISE VALID_STU;
    END IF;
    CLOSE DUMMY_CURSOR;
    EXCEPTION
    WHEN INVALID_STU THEN
    CLOSE DUMMY_CURSOR;
         DBMS_OUTPUT.PUT_LINE ('PLEASE RE-ENTER CLASS ID AND STUDENT ID AS CLASS OR STUDENT IS NOT VALID.');
    WHEN VALID_STU THEN
         CLOSE DUMMY_CURSOR;
         DBMS_OUTPUT.PUT_LINE ('STUDENT CHOOSE SUCCEFULLY!');
    WHEN MUTATING_TABLE THEN
    DBMS_OUTPUT.PUT_LINE ('MUTATING TABLE');     -- ***** NEW *****
         NULL;
    END;
    Output, when trying to UPDATE class:3 = schosen entering check_schosen
    MUTATING TABLE
    1 row updated.
    Obviously, the trigger fired, since you see the message "3 = schosen entering check_schosen"
    Obviously, the OPEN statement raised an error, since you don't see the message 'Cursor is open now.'
    Obviously, the mutating table error was raised, since you see the message 'MUTATING TABLE'.
    So the trigger fired, and went to the EXCEPTION handler almost immediately.  The EXCEPTION handler printed a message, as instructed, and the trigger ended.  Then the actual UPDATE took place.
    I hope this answers your question.
    If not, what is your question?  It may be very clear to you, but a complete mystery to others.  Ask clear questions, such as "Why did ... happen?  I thought ... would happen, be ... as the PL/SQL manual says at ...".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Create ViewCriteria comparing two columns from same table

    Does anyone know how I can create a ViewCriteria where clause that compares two columns from the same table?
    For example if I had two integer columns (MINSAL and MAXSAL) and wanted to see if they are equal. I would normally do the following SQL below.
    SELECT * FROM EMPL
    WHERE MINSAL = MAXSAL

    It works, but it is not ideal.
    Setup a Transient column that performs a groovy evaluation of MINSAL=MAXSAL and then my ViewCriteria evaluates the column to true and I set Query Execution Mode to Both.

  • Creating an employee by copying from other employee

    Hi Guys,
                   I need to create an employee by copying the other employee data for testing purpose.
    Can it been done ?
    Cheers

    Hi,
    When hiring the new employee via PA40, you can fill the "reference personnel number" field.
    By this way, some of the infotypes are copied to the new employee.
    However, there is no option of copying an employee entirely to a new employee number.
    Regards,
    Dilek

  • Outlook 2010 paste from other programs not working.

    Hi,
    Win 7 SP1 x86 w latest patches. Win lang. ENG
    Outlook 2010 SP1 x86 w latest patches. Office lang. ENG
    Regional (date/time and so on) settings EE (Estonia)
    I have about 6 users with same conditions.
    When I'm trying to copy - paste from other programs like IE9, Word, Excel I'm unable to paste into Outlook message body.
    It just wont paste.
    Typically, Outlook shows me "thniking circle" for a millisecond or rarely just hangs.
    There are some exceptions:
    1. I'm able to paste into To: field
    2. I'm able to paste into Subject: field
    3. I'm able to paste even into body if I copied text from Notepad.
    4. I'm able to paste into body when I copied text from another email.
    Additional information:
    Outlook default message format "Plain text" (Rich text, HTML - does'nt matter)
    What I'v tried so far and results:
    1. Repair Office installation trough "Programs and features" - NO LUCK
    2. Changed default paste behaviour from other programs to "keep text only" - NO LUCK
    3. Used SAFE MODE - this helps, paste SEEMS WORKING correctly. Based on my knowledge, SAFE mode mainly disables Add-ins. OK.
    Disabled all Add-ins in normal mode so Outlook shows that "No Active Application Add-Ins" - NO LUCK
    So, I'm out of ideas. I think that this problem starts after installing Office 2010 SP1
    I don't want to uninstall SP1 because for me it's not a solution (SP1 won't dissapear from the list of updates), ok.. agree, it may be
    temporary solution but at the end of the day, there must be something else.
    Any ideas?
    rgds Sven

    Rename normailemail.dotm to .old when Outlook is closed and see if it works now.
    You can find the file here;
    C:\Users\%username%\AppData\Roaming\Microsoft\Templates
    Robert Sparnaaij
    [MVP-Outlook]
    Outlook guides and more: HowTo-Outlook.com
    Outlook Quick Tips: MSOutlook.info
    Thanx, NormalEmail.dotm did not do anything for me but the renaming the Normal.dotm in the same folder did the trick for me. I can paste links again into outlook :)
    Win7 SP1 and Outlook 2010 32bit

  • Cut, copy and paste from other applications not completely cleared

    Hi,
    I'm using build 573.
    When I cut, copy and paste inside Adobe Story synopsis or research content types, I often get text from other applications pasted instead of the text I have cut or pasted from my working document.
    Just to say, it's a little bit annoying when everything else about Adobe Story is so lovely.
    regards
    Martyn

    Hi Anubhav,
    Appologies for the delay in replying.
    0. Apple Mac Book Pro OS X
    1. I mainly use the client on my macbook, or samsung netbook running windows xp and then sync over the web
    2. using cmnd-c, cmnd-v, cmnd-x for mac, ctrl-c, ctrl-v, ctrl-x on windows netbook
    3. I use safari latest version on the mac, and chrome or opera on the netbook.
    Martyn

  • Error After creating 2 new wagetypes.0015 40 00E7 does not exist in T512Z

    Hi Experts,
    I have created 2 new wagetypes.They are properly transported to Quality server.
    And the amount is calculting correctly in Qual server for infotype 0015.Basis guys has transported that request to production server.
    Now  i am unable to find the wagetypes  which i have created.When i go to pa30 and  select 0015 Infotype and subtype 00E7 ,it is saying that specified subtype is invalid.When i try to create  it is giving message that  0015 40 00E7 does not exist in T512Z-Check your entry.Really there is no particular wagetypes in that table.But in Quality they were there.
    What could be the problem.What can i  do to appear those wagetypes in Production Sysytem.
    Please advice me to resolve the issue.
    Thanking You.
    Sai.
    Reg

    Dear Vicky,
    If you have this entry in Q system it should be request transfer issue. I have such a cases sometimes.
    I recommend go to D system, delete the record from V_T512Z and save the table. System will ask you to create a new request. Create it and put your changes into. Go out of table and come back and create the same record into it save your changes.
    Release your request and transfer it again to Q and P. Hope to see  the record in P system.
    Otherwise do the method Okan recommended thru SM30. It works also but sometimes recreating the records are the only solution as I know
    Regards,
    Omid

  • Attempt to create a transformation results in error "transf. does not exist

    Hello,
    We're using BI 7.0 in my dept. I have a Data Store Object that I want to connect with a transformation to my DataSource. All objects are BI 7.0 objects, not 3.x. I right click my DataSource and select "create transformation" - as described in the BI documentation. I enter my DSO object as destination in the pop-up. As soon as I click on "execute" to confirm all entries in the pop-up, I get the error message "transformation does not exist, see long text". In the long text I find "The transformation specified by transformation ID , source  and target , does not exist.". Well - of course my transformation doesn't exist yet, I wanted to create it! Does anyone share my unfortunate experience and found a way out?
    Thanks for any tips you can give me! Annette

    hi annette,
    this is 1 of the possibility. i replicated the issue in my system and this is what i found out...
    when you or whoever replicated the system (r/3 system connected with bw) he/she must have replicated the datasource as a 3x version and NOT as a 7x version. if that's the case, then you must have infosource inbetween (as 3x object you can't connect directly with datasource) and update rules (no transformation works). if that's what happened... then system will not allow you to create a transformation and will give you that error message. so please check if the datasource from r/3 got replicated properly (you have 2 options... replicate as 3x object OR replicate as datasource object 7x)
    hope this helps...
    regards,
    sameer

  • Create a Blank Text file if it does not exist in a Given Directory

    Hi,
    I would like to check if text file in a given folder exists or not if not then create a blank text file in a given directory. I was checking File system task, it has options to create directory and move files, copy files but not creating files.
    How can I create a blank text file in a given directory in SSIS using script task or any other way.
    Many thanks.
    Mustafa
    MH

    Thanks Saravana for your help. I am using the following code in the script Task two
    Imports System
    Imports System.Data
    Imports System.Math
    Imports Microsoft.SqlServer.Dts.Runtime
    Imports System.IO
    Imports System.Object
    Imports System.Security.Cryptography
    Imports System.IO.Compression
    <System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
    <System.CLSCompliantAttribute(False)> _
    Partial Public Class ScriptMain
    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    Enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    End Enum
    ' The execution engine calls this method when the task executes.
    ' To access the object model, use the Dts property. Connections, variables, events,
    ' and logging features are available as members of the Dts property as shown in the following examples.
    ' To reference a variable, call Dts.Variables("MyCaseSensitiveVariableName").Value
    ' To post a log entry, call Dts.Log("This is my log text", 999, Nothing)
    ' To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, True)
    ' To use the connections collection use something like the following:
    ' ConnectionManager cm = Dts.Connections.Add("OLEDB")
    ' cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;"
    ' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    ' To open Help, press F1.
    Public Sub Main()
    ' Add your code here
    Dim inputFile As String
    Dim outputFile As String
    Dim encoding As String
    Dim PrivateKeyInXML As String
    inputFile = Dts.Variables("Item1Path").Value.ToString()
    outputFile = Dts.Variables("OutputFile1").Value.ToString()
    encoding = Dts.Variables("Encoding").Value.ToString()
    PrivateKeyInXML = Dts.Variables("PrivateKey").Value.ToString()
    Dim CallCryptoReader As CryptoReader = New CryptoReader(inputFile, outputFile, encoding, PrivateKeyInXML)
    Dts.TaskResult = ScriptResults.Success
    End Sub
    Public Class CryptoReader
    Private _FileStream As FileStream
    Private _CryptoStream As CryptoStream
    Private _ZipStream As GZipStream
    Private _RSAPrivateKeyinXML As String
    Dim _CryptoAgent As New System.Security.Cryptography.AesCryptoServiceProvider
    'System.Text.Encoding
    Sub New(ByVal inputFile As String, ByVal outputFile As String, ByVal encoding As String, ByVal PrivateKeyInXML As String)
    _RSAPrivateKeyinXML = PrivateKeyInXML
    'Create the crypto agent
    _CryptoAgent = AesCryptoServiceProvider.Create
    '''''''_CryptoAgent.GenerateIV()
    '''''''_CryptoAgent.GenerateKey()
    'Open cypher text for reading in
    _FileStream = New FileStream(inputFile, FileMode.Open)
    ReadHeaderFromFile() 'write out aes key to header
    'Create the stream to decrypt the AES part of the file
    _CryptoStream = New CryptoStream(_FileStream, _CryptoAgent.CreateDecryptor, CryptoStreamMode.Read)
    _ZipStream = New GZipStream(_CryptoStream, CompressionMode.Decompress)
    'setup complete - run decrypt to unprotect the rest of the file
    DecryptFile(outputFile)
    Flush()
    Close()
    Dispose()
    End Sub
    Public Sub Close()
    _CryptoStream.Close()
    _ZipStream.Close()
    _FileStream.Close()
    End Sub
    Public Sub Dispose()
    _CryptoStream.Dispose()
    _ZipStream.Dispose()
    _FileStream.Dispose()
    End Sub
    Public Sub Flush()
    _CryptoStream.Flush()
    _ZipStream.Flush()
    _FileStream.Flush()
    End Sub
    Private Sub ReadHeaderFromFile()
    'Read the AES Key (Protected by RSA Key) and then the IV
    Dim UnProtectedAESKey() As Byte
    Dim buffer(_CryptoAgent.BlockSize - 1) As Byte
    'Read in protected AES Key
    _FileStream.Read(buffer, 0, _CryptoAgent.BlockSize)
    'Decrypt AES Key
    UnProtectedAESKey = releaseKeyFromRSA(buffer)
    _CryptoAgent.Key = UnProtectedAESKey
    ReDim buffer(_CryptoAgent.IV.Length - 1)
    'get IV
    _FileStream.Read(buffer, 0, _CryptoAgent.IV.Length)
    _CryptoAgent.IV = buffer
    End Sub
    Public Sub DecryptFile(ByVal outFilePath As String)
    Dim outFile As New FileStream(outFilePath, FileMode.Create)
    Dim count As Integer = 1024
    Dim buffer(count - 1) As Byte
    Do Until count = 0
    count = _ZipStream.Read(buffer, 0, count)
    outFile.Write(buffer, 0, count)
    Loop
    outFile.Flush()
    outFile.Close()
    outFile.Dispose()
    End Sub
    Private Function releaseKeyFromRSA(ByVal key() As Byte) As Byte()
    Debug.Print("Protected AES Key - " & key.ToString)
    Dim cspParam As New CspParameters()
    Dim RSA As New RSACryptoServiceProvider(1024, cspParam)
    'private
    RSA.FromXmlString(_RSAPrivateKeyinXML)
    Dim decryptedAsByte() As Byte = RSA.Decrypt(key, True)
    Debug.Print("Release RSA - " & System.Text.Encoding.ASCII.GetString(decryptedAsByte))
    Return decryptedAsByte
    End Function
    End Class
    End Class
    I am using the Outputfile1 variable. this is the variable where the path of the file will come which was created in the previous script task. In this task i got the exception that it is alread in use.
    MH

  • Error creating sdo_pc point cloud: "ORA-02289: sequence does not exist"

    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0
    I've come across a problem when creating point clouds - every so often I'll get an error about a sequence not existing.
    ERROR at line 1:
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13249: Stmt-Execute Failure: DROP SEQUENCE "MDPCS_a_17745$$$"
    ORA-29400: data cartridge error
    ORA-02289: sequence does not exist
    ORA-06512: at "MDSYS.PRVT_PC", line 3
    ORA-06512: at "MDSYS.PRVT_PC", line 171
    ORA-06512: at "MDSYS.SDO_PC_PKG", line 179
    ORA-06512: at line 17
    I've got a test case which creates a table where we'll put a sdo_pc, a block table and then a loading XYZ table.  We then loop a bunch of times and create a PC for each.
    Test case setup:
    create table pc_test (
        id integer primary key,
        pc sdo_pc);
    create sequence pc_test_id;
    create table pc_test_blocks as select * from mdsys.sdo_pc_blk_table;
    create table xyz (
        rid number,
        val_d1 number,
        val_d2 number,
        val_d3 number);
    insert /*+ append */ into xyz (
        select
            rownum,
            round(dbms_random.value(1,10000),2),
            round(dbms_random.value(1,10000),2),
            round(dbms_random.value(20,50),2)
        from dual
        connect by level <= 1000);
    commit;
    Run test case:
    declare
      l_pc sdo_pc;
        l_id pls_integer;  
    begin
        for i in 1..50 loop
            l_pc := sdo_pc_pkg.init(
                'PC_TEST', 'PC', 'PC_TEST_BLOCKS', 'blk_capacity=500',
                sdo_geometry(2003, 2157, NULL, sdo_elem_info_array(1,1003,3), sdo_ordinate_array(400000, 500000, 800000, 1000000)),
                0.005, 3, null);
            l_id := pc_test_id.nextval;
            dbms_output.put_line('PC_TEST id=' || l_id);
            insert into pc_test (id, pc) values (l_id, l_pc);
            sdo_pc_pkg.create_pc(l_pc, 'XYZ');
        end loop;
    end;
    Some of the PCs will create, but eventually it'll blow up with
    ORA-02289: sequence does not exist
    In so far as I can tell, once I call sdo_pc_pkg.create_pc(), Oracle is creating a sequence with a name such as MDPCS_a_1751F$$$.  When it is done creating the blocks, it then tries to drop the sequence.  However the statement to drop the sequence is wrapped in double quotes - so if the sequence name contained any lowercase letters then it will error out when trying to drop it.  The values used between the underscores seem to be hexadecimal - sometimes they're numbers only, sometimes numbers and uppercase letters, sometimes numbers and lowercase letters.
    Has anybody else come across this issue?
    The issue isn't critical as the PC blocks do seem to be created correctly, so the issues are: (a) my pl/sql block errors out and (b) I'm left with sequences lying around.
    For the former I'll catch the exception and ignore it, for the latter I'll just drop the sequences myself afterwards.

    I tried the test on 11.2.0.4.  On that release I get an error during a rename:
    ERROR at line 1:
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13249: Stmt-Execute Failure: RENAME "MDPCI_a_26062$$$" TO "M3_A_26062$$"
    ORA-29400: data cartridge error
    ORA-04043: object MDPCI_a_26062$$$ does not exist
    ORA-06512: at "MDSYS.PRVT_PC", line 3
    ORA-06512: at "MDSYS.PRVT_PC", line 157
    ORA-06512: at "MDSYS.SDO_PC_PKG", line 74
    ORA-06512: at line 17

  • Saving photos to the web by creating events. Called the destination folder does not exist.

    Hello,
    I ask you for advice (assistance). A week ago I re-installed the PC and installed to the computer again Photoshop CS5. Everything works for me except for the function of storing images for web by creating events. Called me constantly destination folder does not exist. The problem I had before. I ask you this advice on how to solve this problem.
    Thanks for the advice

    hi,
    i don't know if i integrate your code correctly, but it doens't work for me. I presently create skin for client and this plugin is really usefull for me.
    i use win7 64bit home edition, and photoshop cs5
    there is how i integrate this :
    // EDIT ALEX GRENIER
    function getPreferencesFolder() {
         var userData = Folder.userData;
         if (!userData || !userData.exists) {
              userData = Folder("~");
         var folder = new Folder(userData + "/xtools");
         if (!folder.exists) {
              folder.create();
         return folder;
    function exportChildren(dupObj, orgObj, dupDocRef, folder) {
    if (getCSVersion() >= 10) // CS3 Only
         // Create assets folder in Flex app's directory
         // var tempFolder;
         // tempFolder = new Folder (folder + "/assets/");
         // tempFolder.create();
         // EDIT ALEX GRENIER
         var tempFolder;
         tempFolder = getPreferencesFolder();
    i put the code creating the folder in comment and put your code in place, i also put your function before the function creating file.
    With the base code (without modification) photoshop is able to create my folder assets, but when it try to export the png, it export nothing, so i have a empty folder.
    thank you,
    Alex

  • Error while creating folder: Path is invalid because folder does not exist

    Hi,
    I am having an issue while creating Folders in ID, when I create folder Structure like EDI -> VENDOR -> DELL I am getting the error as below:
    Path /EDI/VENDOR/DELL/ is invalid because folder VENDOR does not exist
    So first 2 levels of folder structure is fine and when I create third level (DELL) I get the above error. Any idea how to resolve this or is this the limitation?
    We have
    Service Pack:06
    Release:NW711_06_REL
    Thanks,
    Laxman

    Hi Laxman,
    Kindly try to refresh the SLD cache by going to Environment -> Clear SLD Data Cache. Make sure that the Cache Status are all in green.
    Hope this would help.
    Regards,
    Jenny

Maybe you are looking for

  • GUI Download to Excel

    I have used the FM 'GUI_DOWNLOAD' to export and internal table to an excel document.  How do I force this to separate the internal table fields into individual columns? Thanks Much.

  • Help, I'm stuck in Freehand, and can't get out!

    I have created a masterpiece :-) brochure cover, with a logo over a graphic, with shadow, and gradient fills. It's not a complex file, and my overseas client wants it for use with Illustrator. However, I can't find a way to get it out and back in to

  • Table of Contents order problem

    I have looked through a number of the other discussions on here, but have not come across my exact problem.  I noticed people where having problems with thier TOC ordering some of the headings properly.  My problem is similar, but I don't see how it

  • Black line to the left of redacted section

    We have couple of users who, when they redact a section of a document (using Acrobat 8 Pro), display a thin black line on the left-hand side of the area that is redacted.  It doesn't happen every time and that is what is confusing me.  Any help would

  • Temporary tables in import

    Hi, i am following the below metalink notes which suggest to export and import first without rows and change the nls_length_semantics from byte to char and import with data. but i can see around 72 temporary tables created and not delted. does import