Dimension load through sql script generated by AWM

Hi,
I have taken the script which AWM has generated while loading a dimenson. I created it as a procedure in the schema where the AW having this dimension exists. The procedure works well when executed in this schema.
Now I want to load the dimension through other schema by executing the procedure. I did following to achieve this:-
1) Grant execute on the procedure is given to new schema
2) Grant all on aw$<aw name>(dim exits in this AW) to the new schema
When I try to run the procedure this give me following error:
Successoracle.AWXML.AWException: Action BUILDDATABASE failed on object XPRO_OLAP_WH.XPRO_OLAP_WH
Am I missing something?
Thanks
Brijesh

Which version?
If 11g, try the following too.
a) use object security (available via awm, right click on dimension and select object security) to give access to dimension for other schema
b) use keyword "AUTHID CURRENT_USER" in pl/sql package/procedure definition.
c)
grant OLAP_USER to <new_schema>;
grant OLAP_XS_ADMIN to <new_schema>;
Try a), b) first. Failing that, try a), b) and c).
HTH
Shankar

Similar Messages

  • Check data before loading through SQL *Loader

    Hi all,
    I have a temp table which is loaded through SQL*Loader.This table is used by a procedure for inserting data into another table.
    I get error of 0RA-01722 frequently during procdures execution.
    I have decided to check for the error data through the control file itself.
    I have few doubts about SQL Loader.
    Will a record containing character data for column declared as INTEGER EXTERNAL in ctrl file get discarded?
    Does declaring column as INTERGER EXTERNAL take care of NULL values?
    Does a whole record gets discarded if one of the column data is misplaced in the record in input file?
    Control File is of following format:
    LOAD DATA
    APPEND INTO TABLE Temp
    FIELDS TERMINATED BY "|" optionally enclosed by "'"
    trailing nullcols
    FILEDATE DATE 'DD/MM/YYYY',
    ACC_NUM INTEGER EXTERNAL,
    REC_TYPE ,
    LOGO , (Data:Numeric Declared:VARCHAR)
    CARD_NUM INTEGER EXTERNAL,
    ACTION_DATE DATE 'DD/MM/YYYY',
    EFFECTIVE_DATE DATE 'DD/MM/YYYY',
    ACTION_AMOUNT , (Data:Numeric Declared:NUMBER)
    ACTION_STORE , (Data:Numeric Declared:VARCHAR)
    ACTION_AUTH_NUM ,
    ACTION_SKU_NUM ,
    ACTION_CASE_NUM )
    What changes do I need to make in this file regarding above questions?

    Is there any online document for this?<br>
    Here it is

  • Error in SQL script  generated from OWB 10.1.0.4.0 Metadata Export Bridge

    Hi... maybe i´m abusing this forum .. but .. when you have questions .. you have to look for answers
    I use OWB 10.1.0.4 to buid some dimensions and one cube. I validate and generate this object and the result was successful.
    I made the deployment and everithing goes OK !!!.
    The problem appears when i want to generate metadata over this objects. I use the option Project > Metadata > Export > Gridge and use the option "Oracle 9i OLAP" like the product where i want to transfer the metadata .. and i got the SQL script without any errors. I suppose that i take the sql script i run it into SQL*plus ... so i do it.. and i got this errors:
    declare
    ERROR at line 1:
    ORA-06501: PL/SQL: program error
    ORA-06512: at line 119
    ORA-06510: PL/SQL: unhandled user-defined exception
    The same error for any dimension in script..
    Any help .. will be fully valued for me ..
    best regards
    Lisandro.

    But how did you identify that there are no runtime records in all_rt_audit_executions for your PL/SQL procedure?
    I guess you tried to search by procedure name... (but what column you used for searching)
    In my case all_rt_audit_executions and wb_rtv_audit_executions contains the same number of records, so they should be always in sync.
    Oleg

  • Loading pl/sql scripts into OWB and running it

    Hi,
    Does anyone have an example for loading and executing PL/SQL Scripts in OWB?.
    Thanks
    Mehdi

    Hi Mehdi,
    Can you be more specific about what you want to achieve?
    Do you mean running a package that OWB generated as a mapping?
    Or running some external code?
    Please check the User Guide, especially chapters 6 (Creating Mappings), 9 (Using Oracle Warehouse Builder Transformations) and 11 (Deploying to Target Schemas and Executing ETL Logic).
    Good luck, Patrick

  • Cannot Load 155MB SQL Script

    Newbie here!
    I am trying to load a 155MB SQL script (mostly INSERTs) in SQL Developer 1.2 and the program never displays the file and the tab at the top of the workspace turns gray. There is a lot of Disk and CPU activity right up until the point where it stops. Is there any way to run the script without loading it into the editor? I just need to build the table, not edit the script.
    I can create and insert into smaller tables fine. I also have the same problem on other scripts of similar size or larger.
    The system is a Pentium 4/1.7GHz (1GB RAM, XP SP2, 60GB Partition) running Database XE (10g) just downloaded last week. The 155MB script was created by SQL Developer on another system/database.
    Thanks!

    Thanks, that's what I was looking for and got me going. Still, I'm having a lot of trouble with these files that seem to be related to serious bugs in SQL Developer 1.1's Export>Insert on my source system. I'm having to reload most of these files using SQL*Plus because SQL Developer 1.2 hangs or drops rows with no explanation. Even SQL*Plus is struggling with them, which all points back to a faulty Export>Insert.
    I cannot believe this is a 1.2 release...
    However, thanks for the great help!

  • Importing HTMLDB application through sql scripts

    I have a question regarding importing application in HTML DB. We have developed an application in one of our instances and now we would like
    to deploy the same in all other instances (around 180 instances). We will copy the schema objects through export / import from the backend (through a script). But to import the application, we need to logon to htmldb (from frontend ) and import it.
    As we have to do it across 180 instances, its very difficult to do it after login to htmldb and import the application. We would like to know if we can import an application and workspace by running the sql scripts ( created by exporting application and workspace on source instance) in the sqlplus prompt.
    In this regard could any one please let me know about the following things.
    1. Can we directly run the sql's (which were created when we exported workspace and application) in the target database?.
    2. If yes, from which user we should run this sql script (Presently we are using HTMLDB 2.0 version)
    I have also noticed the following schemas are locked in the database.
    FLOWS_020000
    FLOWS_FILES
    FLOWS_010500
    3. Are there any extra steps which we need to do it after running the sql scripts in target instance.
    4. Is there any way to delete the application and workspace from backend (i.e sqlplus) incase if we need to re-import the same application and workspace.
    (This situation arises if we need to make any changes to the application after deploying it in the data center.)
    Your help in this regard is highly appreciated.
    Thanks in advance.
    Suneel

    if we can import an application and workspace by running the sql scripts ( created by exporting application and workspace on source instance) in the sqlplus prompt
    Yes, you can.
    1. Yes.
    2. The workspace export files need to be run as the FLOWS_nnnnnn schema (depending on which version of HTML DB is the active one, you seem to have both 1.5 and 2.0 installed). Yes, you would need to unlock the account first to do this.
    3. If your application needs external CSS or Javascript or image files, you need to copy those over using standard OS file copy tools
    4. Importing a application using SQL*Plus deletes the existing application first so you are fine. You would never need to delete a workspace, a workspace is just a "shell", a container for all your applications.
    Hope this helps.

  • Unable to generate the XML file through SQL script. getting error PLS-00306

    I am fetching the data from cursor and generating the xml output I am getting the below error.
    When I have checked the cursor query it is fetching the data in to single column.
    Input truncated to 1 characters
    Enter value for 7: EXEC FND_CONC_STAT.COLLECT;
    DBMS_LOB.append (tmp_file, r.core_xml);
    ERROR at line 95:
    ORA-06550: line 95, column 7:
    PLS-00306: wrong number or types of arguments in call to 'APPEND'
    ORA-06550: line 95, column 7:
    PL/SQL: Statement ignored

    Hi Alex,
    thanks for the responce..
    i have fixed the issue
    i have used XMLAttributes to get the value
    SELECT XMLELEMENT (
    NAME "TranACK",
    XMLAttributes ('1' as "TranNum",
    (select distinct to_char(SYSDATE,'yyyy-mm-dd')
    from DUAL) as "PrcDate"),
    XMLFOREST (
    a.PAYMENT_ID AS "PmtID"),
    XMLFOREST (
    a.ACK_TRANSACTION_RECEIVER AS "Name1"),
    XMLFOREST (
    to_char(a.VALUE_DATE,'yyyy-mm-dd') as "ValueDate" ),
    XMLFOREST (
    a.PAYMENT_AMOUNT AS "CurAmt"),
    XMLFOREST (
    a.CURRENCY_CODE AS "CurCode")
    ).getclobval ()
    AS line_xml
    FROM XXWAP_PAYMENT_LINE_TBL a
    where a.PAYMENT_BATCH_ID=P_batch_id;

  • Proper formatting for dimension properties in SQL script logic

    Hi all,
    I'm trying to pass the time member from a property in account dimension. (Post recognized revenue by looking at deferred revenue accounts.)  The dimension ACCTREV has a property called DATENAME.  DATENAME refers to a valid TIME member.  In 4.2 this logic worked fine.  In 5.1sp3 it's not passing the correct time period (formula log indicates null value for time member).
    For example:  ACCTREV = 4101Billing_2008.JUN    DATENAME = 2008.JUN     (DATENAME is a property of ACCTREV)
    Here's the logic:  *REC(EXPRESSION=%VALUE%,TIME=ACCTREV.DATENAME,ACCTREV=ACCTREV.ACCT)     
    I've read the other post indicating brackets are required by SQL when passing parameters that contain delimiters like "." but it doesn't say how to do it!
    I've tried TIME=ACCTREV.DATENAME  resulting in null time members.
    I've tried TIME=ACCTREV.DATENAME  resulting in null time members. 
    I've updated the property value to 2008.JUN with TIME=ACCTREV.DATENAME resulting in null time members.
    Also how do you post a thread using a bracket without turning it into a hyperlink? 
    Any help would be greatly appreciated.
    Edited by: Ara Toroyan on Aug 5, 2008 2:24 AM

    Thanks Kranthi,
    It's still not working.
    I believe the problem is SQL 2005 related and the DATENAME "2008.JUN." 
    ACCT is a property of ACCTREV and the properties refer to valid ACCTREV members.
    DATENAME is a property of ACCTREV and refers to valid TIME members-- not TimeID or UserTimeID
    The formula log reveals the correct ACCTs but no TIME (null values). The problem is with DATENAME.  Closer inspection of the formula log below shows that Query1 doesn't load DATENAME.  (Not sure why but this could be because of improper formatting.)
    I've validated the existence of all property values with =EVPRO.  The values are part of the dimension tables.
    Here's the forumula log:  (I've deleted some of the product and time members in the log for brevity.)
    Number of logic calls:1
    Call no. 1, logic:D:\BPC\Data\WebFolders\SecondTry\REVENUE
    ..\AdminApp\REVENUE\RevRec.LGX
    Building sub-query 1
    Query Type:0
    Max members:
    Region:
    DIMENSION:ACCTREV
    4101BILLING_2008.JUN,4201BILLING_2008.JUN,4206BILLING_2008.JUN,4207BILLING_2008.JUN,4208BILLING_2008.JUN
    DIMENSION:CATEGORY
    ACTUAL
    DIMENSION:PRODUCT
    0000,0001,0005,0010,0011,0012,0013,0020,0024,0030,0031,0040,0050,0059,0065,0066,0067,0070,0071,0075,0078,0079,0080,0099,0140,0145
    DIMENSION:REVDATA
    REV_AMOUNT
    DIMENSION:TIME
    2001.JAN,2001.FEB,2001.MAR,2001.APR,2001.MAY,2001.JUN,2001.JUL,2001.AUG,2001.SEP,2001.OCT,2001.NOV,2001.DEC,2002.JAN,2002.FEB,2002.MAR,2002.APR,2002.MAY,2002.JUN,2002.JUL,2002.AUG,2002.SEP,2002.OCT,2002.NOV,2002.DEC,2003.JAN,2003.FEB,2003.MAR,2003.APR,2003.MAY,2003.JUN,2003.JUL,2003.AUG,2003.SEP,2003.OCT,2003.NOV,2003.DEC,2004.JAN,2004.FEB,2004.MAR,2004.APR,2004.MAY,2004.JUN,2004.JUL,2004.AUG,2004.SEP,2004.OCT,2004.NOV,2004.DEC,2005.JAN,2005.FEB,2005.MAR,2005.APR,2005.MAY,2005.JUN,2005.JUL,2005.AUG,2005.SEP,2005.OCT,2005.NOV,2005.DEC,2006.JAN,2006.FEB,2006.MAR,2006.APR,2006.MAY,2006.JUN,2006.JUL,2006.AUG,2006.SEP,2006.OCT,2006.NOV,2006.DEC,2007.JAN,2007.FEB,2007.MAR,2007.APR,2007.MAY,2007.JUN,2007.JUL,2007.AUG,2007.SEP,2007.OCT,2007.NOV,2007.DEC,2008.JAN,2008.FEB,2008.MAR,2008.APR,2008.MAY,2008.JUN,2008.JUL,2008.AUG,2008.SEP,2008.OCT,2008.NOV,2008.DEC,2009.JAN,2009.FEB,2009.MAR,2009.APR,2009.MAY,2009.JUN,2009.JUL,2009.AUG,2009.SEP,2009.OCT,2009.NOV,2009.DEC
    Loading ACCTREV.DATEID,ACCT
    Loading TIME.TIMEID
    Time to load properties:0.0 sec.
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    into #tblTempLogic_349866
    from tblFactREVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000') AND  REVDATA=N'REV_AMOUNT'
    insert into #tblTempLogic_349866 (ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA)
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    from tblFactWBREVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175',N'0181',N'0182',N'0183',N'0185',N'0190',N'0200',N'0201',N'0210',N'0251',N'0275',N'0302',N'0305',N'0310',N'0802',N'1000',N'1002',N'1012',N'1016',N'1017',N'1026',N'1030',N'1033',N'1035',N'1041',N'1042',N'1054',N'1055',N'1059',N'1061',N'1062',N'1063',N'1065',N'1069',N'1073',N'1080',N'1082',N'1093',N'1100',N'1111',N'1120',N'1172',N'1210',N'1300',N'1700',N'1701',N'1800',N'1900',N'2082',N'2092',N'2110',N'2115',N'2118',N'2120',N'2121',N'2123',N'2124',N'2126',N'2136',N'2140',N'2150',N'2160',N'2170',N'2200',N'2201',N'2220',N'2225',N'2300',N'2500',N'2600',N'2611',N'2700',N'2701',N'2712',N'2715') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000',N'20041100',N'20041200',N'20050100',N'20050200',N'20050300',N'20050400',N'20050500',N'20050600',N'20050700',N'20050800',N'20050900',N'20051000',N'20051100',N'20051200',N'20060100',) AND  REVDATA=N'REV_AMOUNT'
    and SOURCE = 0
    insert into #tblTempLogic_349866 (ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA)
    select ACCTREV,PRODUCT,TIMEID,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    from tblFAC2REVENUE
    WHERE  ACCTREV in (N'4101BILLING_2008.JUN',N'4201BILLING_2008.JUN',N'4206BILLING_2008.JUN',N'4207BILLING_2008.JUN',N'4208BILLING_2008.JUN') AND  CATEGORY=N'ACTUAL' AND  PRODUCT in (N'0000',N'0001',N'0005',N'0010',N'0011',N'0012',N'0013',N'0020',N'0024',N'0030',N'0031',N'0040',N'0050',N'0059',N'0065',N'0066',N'0067',N'0070',N'0071',N'0075',N'0078',N'0079',N'0080',N'0099',N'0140',N'0145',N'0154',N'0155',N'0156',N'0157',N'0161',N'0162',N'0163',N'0164',N'0165',N'0171',N'0175',N'0181',N'0182',N'0183',N'0185',N'0190',N'0200',N'0201',N'0210',N'0251',N'0275',N'0302',N'0305',N'0310',N'0802',N'1000',N'1002',N'1012',N'1016',N'1017',N'1026',N'1030',N'1033',N'1035',N'1041',N'1042',N'1054',N'1055',N'1059',N'1061',N'1062',N'1063',N'1065',N'1069',N'1073',N'1080',N'1082',N'1093') AND  TIMEID in (N'20010100',N'20010200',N'20010300',N'20010400',N'20010500',N'20010600',N'20010700',N'20010800',N'20010900',N'20011000',N'20011100',N'20011200',N'20020100',N'20020200',N'20020300',N'20020400',N'20020500',N'20020600',N'20020700',N'20020800',N'20020900',N'20021000',N'20021100',N'20021200',N'20030100',N'20030200',N'20030300',N'20030400',N'20030500',N'20030600',N'20030700',N'20030800',N'20030900',N'20031000',N'20031100',N'20031200',N'20040100',N'20040200',N'20040300',N'20040400',N'20040500',N'20040600',N'20040700',N'20040800',N'20040900',N'20041000',N'20041100',N'20041200',N'20050100',N'20050200',N'20050300',N'20050400',N'20050500',N'20050600',N'20050700',N'20050800',N'20050900',N'20051000',N'20051100',N'20051200',N'20060100') AND  REVDATA=N'REV_AMOUNT'
    select tmpTable.ACCTREV,tmpTable.PRODUCT,tmpTable.TIMEID,tmpTable.COMPANY,tmpTable.CUSTOMER,tmpTable.DATASRC,tmpTable.LOCATION,tmpTable.MEDIAID,tmpTable.PRODTYPE,tmpTable.TRANSID,sum(SIGNEDDATA) as SIGNEDDATA
    from #tblTempLogic_349866 as tmpTable
    group by tmpTable.ACCTREV,tmpTable.PRODUCT,tmpTable.TIMEID,tmpTable.COMPANY,tmpTable.CUSTOMER,tmpTable.DATASRC,tmpTable.LOCATION,tmpTable.MEDIAID,tmpTable.PRODTYPE,tmpTable.TRANSID
    drop table #tblTempLogic_349866
    Time to load Source data:2.6 sec.
    29123 records to process
    Time to Prepare data process:0.0 sec.
    Time to initialize destination:0.0 sec.
    Time to get source data:0.0 sec.
    29123 scanned records
    0 skipped records
    29123 processed records
    29123 records generated
    Time to Scan data:5.5 sec.
    Time to get output data:0.1 sec.
    Time to prepare final strings:0.3
    Total processing time:5.9
    App: REVENUE - Records to be posted are 29119  (calc diff = 0)
    CATEGORY,REVDATA,ACCTREV,PRODUCT,TIME,COMPANY,CUSTOMER,DATASRC,LOCATION,MEDIAID,PRODTYPE,TRANSID,SIGNEDDATA
    ACTUAL,REV_AMOUNT,4101,0001,,03,2282436,INPUT,00,ZZ,NONE,MANUAL_TRANSBASED,-208.5
    ACTUAL,REV_AMOUNT,4101,0010,,03,1000105,INPUT,00,20,CURR,TRANSACTION_BASED,-88
    ACTUAL,REV_AMOUNT,4101,0010,,03,1000105,INPUT,00,20,HIST,TRANSACTION_BASED,-60

  • Loading through sql* loader

    Hi,
    I want to load xml file data using sql*loader into Oracle.
    Kindly advice what could be the pros & cons for this.
    Is there any online document for this?
    Thanks
    Deepak

    Is there any online document for this?<br>
    Here it is

  • Is it possible to load an external sql script by connecting to a mysql data

    hi,
    this is ayesha parween.
    Basically we manually connect to the mysql server and go to the administrator and take the back up of the file
    and load the sql script for creating a schema creating the tables and populating the tables with the data.
    Is it possible through some java jdbc for connecting to the mysql server and creating the schema and creating the table structure and populating the tables with data.
    And if there is any error display some message.
    Regards,
    Ayesha.

    hi,
    this is ayesha parween.
    Basically we manually connect to the mysql server and go to the administrator and take the back up of the file
    and load the sql script for creating a schema creating the tables and populating the tables with the data.
    Is it possible through some java jdbc for connecting to the mysql server and creating the schema and creating the table structure and populating the tables with data.
    And if there is any error display some message.
    Regards,
    Ayesha.

  • Generate SQL scripts from Designer 6

    Hi all,
    Does anyone know how to generate an SQL-script from Designer? I want to maintain the code in the repository, and also document usages against the script. I've found ways to document the script, but then I can't generate it....
    Thanks in advance,
    Ronald

    Ronald,
    How did you record the SQL script in designer? As undefined pl/sql module (type= "null")?
    If so, you cannot generate the script with the ddl generator. To do so you could change the type to procedure and make post-generation changes to the script (cut of f the procedure header and trailer lines). An other way to generate it is to write your own SQL script generator as a headstart utility. You might take a look at the html help file generator utility which does a similar job (create a o/s file based on the repository contents).
    Let us know if you succeed.
    Regards, Marc
    null

  • How to execute sql scripts from Powershell across multiple databases

    Re: How to execute sql scripts from Powershell across multiple databases
    I have an tsql script that I want to run across a list of databases. How is the best way to do this in Powershell? Thanks.

    My example below, using just the SMO and not breaking up the batches, the ExecuteWithResults give the following error when the .sql file contains a GO. My script files are as simple as a DECLARE and then a GO.
    WARNING: SQL Script Failed
    The object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not valid or not in the correct sequence. This is likely caused by a user-specified "format-list" comm
    and which is conflicting with the default formatting.
        + CategoryInfo          : InvalidData: (:) [out-lineoutput], InvalidOperationException
        + FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand
    Also, when executing from the ISE, is there a way to force the ISE to release the files. I am having to close the ISE and reopen my script every time I want to make a testing change to the .sql file.
    [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")
    $scriptspath = "C:\temp\psExecuteSQLScripts\scripts"
    $SQLServer = "fidevc10"
    $SQLDB = "Bank03"
    # Create SMO Server Object
    $Server = New-Object ('Microsoft.SQLServer.Management.Smo.Server') $SQLServer
    # Get SMO DB Object
    $db = $Server.Databases[$SQLDB]
    # Load All SQL Scripts in Directory
    $scripts = Get-ChildItem -Path (Join-Path $scriptspath "*") -Include "*.sql" -Recurse
    # Loop through each script and execute
    foreach ($SQLScript in $scripts)
    $fullpath = $SQLScript.FullName
    # Read the Script File into Powershell Memory
    $reader = New-Object System.IO.StreamReader($fullpath)
    $script = $reader.ReadToEnd()
    # Execute SQL
    Write-Host "Executing $SQLScript on $SQLDB...."
    try
    $ds = $db.ExecuteWithResults($script)
    Foreach ($t in $ds.Tables)
    Foreach ($r in $t.Rows)
    Foreach ($c in $t.Columns)
    Write-Host $c.ColumnName "=" $r.Item($c)
    Write-Host "Complete"
    catch [Exception]
    Write-Warning "SQL Script Failed"
    echo $_.Exception|format-list -force
    Write-Host " " -BackgroundColor DarkCyan

  • Underlying SQL or SQL Script for Calculated Views Create Graphically

    Hello,
    Is it possible to view the SQL or SQL script generated for calculated views that are created graphically?

    Hi Mike,
    For your calculation view you will find the corresponding column view created in schema '_SYS_BIC'-->Column Tables->
    <packagename>/<Calculation view> --> Open Definition of this and check the 'create statement'.
    Note: This is a information modeler generated SQL script which will show the generated Calculation Scenario and the respective Column View.
    Regards, Rahul
    Seems the answer was already given by Murali while I typed
    Edited by: Rahul Pant on Mar 2, 2012 5:22 AM

  • Executing sql script from file, with multiple queries

    Hello,
    I am trying to load an SQL script from a file, parse the script into separate SQL statements, and execute each of them. The final statement will always be a query, and thus will return a result.
    Three problems arise:
    1. I don't know what TYPE of statement each one is (i.e. whether it is an UPDATE or a QUERY), which seems to be required in order to execute it in java (via executeQuery and executeUpdate).
    2. I am not sure of the best way to execute a series of statements (the Statement object has some "batch" functionality, but I'm not sure if there is a better way, or even of the proper way to use this).
    3. I need to be able to make sure the final statement is a QUERY, and thus will return a ResultSet. Otherwise I need to be able to throw an exception.
    This has been causing me a lot of trouble. Any help would be much appreciated.
    Thanks,
    Kevin

    Hi Kevin,
    Have you got any solution for your mentioned problem????
    I am facing almost the same kind of problem like I have some sql files containg simple sql statements as well as code for writting Procs , triggeres, index...functions..and so on. I need to execute this XYZ.sql file from Java side.
    Can you guide me about my problem?????
    Thanks in advance.............
    Mak

  • Essbase substitution variable used for SQL Dimension load-URGENT

    Hi All,
    I am creating one dimension through SQL Dimension load rule writing by parent child build rule. The SQL query is like below---
    distinct trim(dist_mobile),trim(ret_mobile) from dist_retailer al1 where al1.proc_dt=to_date(&Proc_date,'dd/mm/yyyy')
    When I fixed the value of proc_date (e.g.- '27/09/2008') then it is retrieving data properly, but when I try to make the same as a essbase variable as shown above (to give user the priviledge to select for which date data will be fetched from RDBMS to create the dim) and after setting the aforesaid value of that variable in essbase subs var screen and click 'OK/Retrieve' in rule,it is returning no rows executing the query as well as no error coming.
    I guess in query nothing is wrong but the subs variable part is not working. Can anybody please give some insight to resolve the problem.
    In this context, I would like to mention that I will have to use substitution variable in some other rule file also to automate the load process. How can I use essbase subs variable in SQL load rule? Could you please show me a proper summarise query illustrating how to use the subs var in aforesaid purpose for the sake of understanding?
    Thanks in advance.

    Hi,
    Sorry for delayed response. Appreciate your inputs. At last I have found out the solution which is as below----
    distinct trim(dist_mobile),trim(ret_mobile) from dist_retailer al1 where al1.proc_dt=to_date('&Proc_Dt','dd/mm/yyyy')
    after setting the substitution variable as Proc_Dt and set the value as 27/09/2008 (without any quotation mark or such sign) now I checked and now it is retrieving fine.
    Thanks & Regards.

Maybe you are looking for