Set substitution variable from Sql table

Hi guys,
I am new to sql/unix so I hope you can guide me in the right direction.
whats the easiest way to update an essbase subvar from a sql table?
would I have to write a sqlplus statement to output the variable to file,
read the file in a maxl command and set the variable and call these commands using .sh script and esscmd?
is there a more efficient way to set the variable? e.g only use sqlplus and esscmd?
thanks in advance,

Try something like this
echo off
sqlplus -s username/passwordusername/password@server/SID:@server/SID:port @test.sql > variable.txt
for /f "usebackq delims=" %%a in (variable.txt) do set CurrentMonth=%%a
echo %CurrentMonth%
See whether you are getting the correct month.
Regards
Celvin
http://www.orahyplabs.com

Similar Messages

  • Essbase server - automatic change of substitution variable from SQL

    Hi,I would like to automaticaly change the substitution variable in Essbase Server. Is it posible to change the substitition variable from external source e.g. SQL statement?Simple sample:I would like to assign value "2003" to "CurYear" substitution variable. But value "2003" I would like to get from SQL:"select year(current date) from table".There are commands in Esscmd and MaxL Shell, see bellow.Esscmd command:CREATEVARIABLE "CurYear" "localhost" "" "" "2003";MaxL Shell:alter system set variable CurYear '2003';Is it possible to get the value '2003' from SQL and pass this value to Esscmd command or MaxL Shell?My system:Windows 2000 Professional Service pack 4Essbase at 6.5.3 levelThanks,Grofaty

    You can create a text file from the SQL server that writes the command like"CREATEVARIABLE "CurrYear" "Servername" "AppName" "DBName" "2005";then you can create a schedule job that would run this script which can update the variable. CREATEVARIABLE creates/replaces the current variable.

  • Pull data from SQL Table and display it in mail

    I have a requirement to pull the data from SQL table and send it in email.  Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email? 
    Can you guide me with steps on this.
    Neil

    There are several ways to do this.  First is to populate a file in a data flow and then send that as an attachment in the send mail task. 
    As far as including the results in the email body this becomes a bit trickier.  To use a variable you would need to use an SSIS variable type of
    Object, this is similar to a collection in .NET.  The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection.  There is no native method to take the object variable and
    specify .ToString() or cast its results as text.  You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
    Also you mentioned formatting the results.  What type of formatting were you looking for.  A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
    would have to use a script task or a custom component
    David Dye My Blog

  • Regarding hierarchy creation from sql tables using db / ud connect

    bw version 3.0 upgrading to 7.0
    sql version 2005.
    we had built a sql data mart which is being accesses by a number of reporting tools. BI is one of the systems connected to it. My requirement is to upload hierarchies like customer from the sql data mart in to BW.
    The sql tables are in a denormalized format like this,
    EMPLOYEE_ID LAST_NAME                 MANAGER_ID      LEVEL
            101 Kochhar                          100                             1
            108 Greenberg                        101                            2
            109 Faviet                           108                                3
    They say that all third party reporting tools will recognize the above format and it universal. <b>I wanted to know is there any setting in bw that will allow extraction of hierarchies from the above table format ? if not I can only think of arranging data in the format of BW transfer structure, similar to flat file load.</b>
    I want to know can I upload hierarchies from sql tables or should I create flat files from tables ?
    Inputs will be awarded points.
    Message was edited by:
            aravind sam

    generate datasource? see if this can help..
    RSA1-> SOURCE SYSTEM-> SELECT YOUR SOURCE SYSTEM-> RIGHT CLICK-> GENERATE SOURCE SYSTEM.
    Also check:
    DB connect ORACLE - table name not found
    Re: Bw With ORacle
    Datasource in DB Connect
    and OSS Notes: 518241
    assign points if useful ***
    Thanks,
    Raj

  • Set 2 variables (PL/SQL)

    Hi,
    I would like to set 2 variables PL/SQL with a query like that :
    SELECT FINAC_USER.NM_FIRST_NAME INTO FIRST_N,
    FINAC_USER.NM_LAST_NAME INTO LAST_N
    FROM FINAC_USER
    WHERE FINAC_USER.CD_USER = CODE_USER;
    But Oracle sends me an error :
    PL/SQL: ORA-00923: FROM keyword not found where expected
    How can I do that ?
    Thank you for your help.
    Patrick

    anutosh, please do not answer questions that have already been answered. You have done that several times here now. It is not a good use of our time to open up a thread and see that the only new entry is the rewording of a valid answer already provided.

  • Fill Variables From a Table

    I have a requirement to write a query which is much like an aged debt report.
    I would have a number of variables which will allow the user to create buckets of data, i.e. invoices that are not yet due, 30 days overdue, 60 days overdue, 90 days overdue, etc. However, the data will be coming from CRM, and I would like to pre-fill the variables from a table, and not have the user enter them every time they wish to run the query. The table containing the variable values will also be extracted from CRM into BW.
    Does anybody have any idea how I can pick the bucket parameters up to use in my query?

    Stuart,
    if you know already how to build and fill this kind of variable (but for other purpouse), you start from a very good point !!!
    It's enough to do a select onto the table on which you pass the relevant values (do you need some ABAP sample ? with the search engine you can find a lot of good example) ...or do you have problem to pass these values from CRM environment...let us know if you need some more specific!
    Bye,
    Roberto
    (about point, I think it's enough to hit the radiobutton that you should find in every answer...if there is some problem, write an e-mail to [email protected] or wait for some minute..)

  • Is it possible to read Essbase Substitution variables from ODI?

    Is it possible to read Essbase Substitution variables from ODI?

    Hi,
    You can do it with custom code, if you have a read of a blog I wrote :- http://john-goodwin.blogspot.com/2009/11/odi-series-planning-11113-enhancements.html
    About half way through I go into reading essbase sub vars using the essbase java API.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Create shared variables from a table

    hi!!
    well, what i want to do is to create a shared variable using a table, with variables names and values i want to take them,
    i have a litte example, to see how can i take the name of the shared variables from a table,
    can you help me??
    thanks
    Attachments:
    Shared Variable.vi ‏28 KB

    HI!!
    i have done a program, where i create a sv library, after that i deploy it and finally i want to write something on this sv that i created...
    all runs ok, but i  cant see what i am writting in this sv, for that i choose the NI distributes system manager,
    can someone help me please????
    i think is because the type of data...
    thanks!
    Attachments:
    SV_create_deploy_write.zip ‏34 KB

  • Substitution variable in sql load rules file

    Okay gurus,
    I need a little guidance, I have to replace the value of 201020 and 2008 from substitution variables. I have created the variables and set them up globally on the essbase server.
    201020 = FW00
    2008 = FY00
    WHERE ACT.FISCAL_WEEK_ID <= 201020
    AND ACT.FISCAL_YEAR_ID > 2008
    AND RTDIV.DIV IN (1,2,3,4,5,6,7,8,9,99) (This is the query with hard coded values of week and year)
    When i m trying to put sub variables there , its throwing the error. please find below the way i was trying to do it.
    WHERE ACT.FISCAL_WEEK_ID = '&FW00'
    AND ACT.FISCAL_YEAR_ID = '&FY00'
    But unfortunately, its throwing error Error: 1021001 Failed to Establish Connection With SQL Database Server. See log for more information
    I know that this is the generic error because if i put the hard coded value in sql load rules it works fine.
    Is it the right way to out sub var in sql load rules???
    Please advice and thanks in advance.

    Hi Genn,
    I tried to see the app log for sql but i m afraid that there is nothing in there, the only error message which I am getting in app log is this:
    Failed to Establish Connection With SQL Database Server. See log for more information
    Its an ASO cube and initially i was using the variable as FY00 AS "2008" it did not work and than i tried without quotes in variable but is still not working.
    Any idea..thanks in advance.

  • Can I create ASP user validated website using existing MD5 passwords from SQL table?

    I'm attempting to build a user authenticated site in Dreamweaver CS5 using an existing USERS table from another site.  The password field in the existing SQL table appears to be MD5 encoded.  How can I MD5 encode the form field (or the SQL query) so that it verifies MD5 to MD5?
    Currently, it's comparing the form's plain text field to the MD5 encrypted password field in SQL.
    I've built a simple login form using the following:
    <form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
        <input name="username" type="text" id="username" accesskey="u" tabindex="1" /><input name="password" type="password" id="password" accesskey="p" tabindex="2" /><input name="submit" type="submit" value="submit" />
        </form>
    With the stock Dreamweaver Log In User Server Behavior as follows:
    <%
    ' *** Validate request to log in to this site.
    MM_LoginAction = Request.ServerVariables("URL")
    If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
    MM_valUsername = CStr(Request.Form("username"))
    If MM_valUsername <> "" Then
      Dim MM_fldUserAuthorization
      Dim MM_redirectLoginSuccess
      Dim MM_redirectLoginFailed
      Dim MM_loginSQL
      Dim MM_rsUser
      Dim MM_rsUser_cmd
      MM_fldUserAuthorization = ""
      MM_redirectLoginSuccess = "results.asp"
      MM_redirectLoginFailed = "error.html"
      MM_loginSQL = "SELECT user_name, password"
      If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
      MM_loginSQL = MM_loginSQL & " FROM dbo.users WHERE user_name = ? AND password = ?"
      Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
      MM_rsUser_cmd.ActiveConnection = MM_ADSX_STRING
      MM_rsUser_cmd.CommandText = MM_loginSQL
      MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 32, MM_valUsername) ' adVarChar
      MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 32, Request.Form("password")) ' adVarChar
      MM_rsUser_cmd.Prepared = true
      Set MM_rsUser = MM_rsUser_cmd.Execute
      If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
        ' username and password match - this is a valid user
        Session("MM_Username") = MM_valUsername
        If (MM_fldUserAuthorization <> "") Then
          Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
        Else
          Session("MM_UserAuthorization") = ""
        End If
        if CStr(Request.QueryString("accessdenied")) <> "" And false Then
          MM_redirectLoginSuccess = Request.QueryString("accessdenied")
        End If
        MM_rsUser.Close
        Response.Redirect(MM_redirectLoginSuccess)
      End If
      MM_rsUser.Close
      Response.Redirect(MM_redirectLoginFailed)
    End If
    %>
    Please help!

    unfortunately classic asp does not have a built in function for md5. what we used for our legacy sites is a javascript that hashes a string to MD5. here's the code we've used in the past http://pajhome.org.uk/crypt/md5/md5.html
    your asp should have something like this...
    <script language="jscript" src="path_to_js_file/md5.js" runat="server"></script>
    <%
    'hash the password
    Dim md5password       ' md5password variable will hold the hashed text from form variable txtPassword
    md5password = hex_md5(""&Request("txtPassword")&"")
    ' based on the code you posted...
    MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 32, md5password) ' adVarChar
    %>

  • Using substitution variable in sql -- Issue

    Hello All
    I am trying to do a sql operation from command prompt of my system and that sql requires substitution variable which i am passing it but when i pass the variable ( there are two) the first one assign as " \c" and second gets both what i am passing.
    I am not sure what exactly happening here, i have done this on AIX but here its not working any ideas?
    System : uname -a
    Linux ## 2.6.18-128.1.1.el5 #1 SMP Mon Jan 26 13:58:24 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

    AIX and Linux are not the same. An output of "\c" may indicate a compatibility issue of your shell script with your current command line interpreter (shell). A \c can be used to suppress a newline with the echo command. Bash understands both formats echo -n and echo \c, but other shells like Ksh don't. Try to run your script under a Bash, which is the default under Linux. If the problem persists you will need to post your script for any further analysis.

  • Error with define substitution variable in SQL

    Hi there,
    I am using PL/SQL developer and trying to define a substitution variable as follows:
    define freq = 'Weekly'
    Then later on, in my SQL statement, I used this variable in WHERE statement as follows:
    WHERE ... (&freq = 'Weekly') and ...
    But I got the "ORA-00904: "WEEKLY": invalid identifier" error.
    Where is the problem?
    Thanks in advance!

    I don't know about PL/SQL developer but in sqlplus you need single quotes around the variable.
    SQL> define freq = 'Weekly'
    SQL> select null from dual
      2  where &freq = 'Weekly';
    old   2: where &freq = 'Weekly'
    new   2: where Weekly = 'Weekly'
    where Weekly = 'Weekly'
    ERROR at line 2:
    ORA-00904: "WEEKLY": invalid identifier
    SQL> edi
    Wrote file afiedt.sql
      1  select null from dual
      2* where '&freq' = 'Weekly'
    SQL> /
    old   2: where '&freq' = 'Weekly'
    new   2: where 'Weekly' = 'Weekly'
    N
    SQL>

  • Dynamically Setting a Variable from a Connection String that has been set by a Config File

    Hi Guys
    I'm setting up a Master / Slave (Parent / Child) dtsx environment but I'm unable to work out how to dynamically set a variable in the Master dtsx from a connection string that has had its value set by a config file. I'm sure it's possible.
    Below is the what I'm hoping to achieve. I've set up everything apart from the highlighted section.
    Any ideas?

    First, what version of SQL Server are you using?
    You could switch the problem around.  You could set the value of a variable from the config file, then it is easy to use that variable as the connection string source for your connection manager.  At the same time you can use a parent variable
    configuration to map that variable to variables in your child package.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Substitution variables in Sql*Plus

    Hi all,
    How to make Sql*Plus ask for the substitution variable value one time only for a substitution variable even if it appears multiple times inside a query ? Because so far each time I launched the query below then I have been asked two times by Sql*Plus for the variable value. For example : select ref_site from t_comsis where longitude_lamb + latitude_lamb < &distance + power(&distance,2).
    Thanks

    of course accept is more friendly, you can check for valid number, you can have a prompt or a hidden input.
    you can also undef your variable if you prefer the && solution
    SQL> select &&x+&&x from dual;
    Enter value for x: 1
    old   1: select &&x+&&x from dual
    new   1: select 1+1 from dual
           1+1
             2
    SQL> undef x
    SQL> r
      1* select &&x+&&x from dual
    Enter value for x: 2
    old   1: select &&x+&&x from dual
    new   1: select 2+2 from dual
           2+2
             4

  • Setting substitution variable to connection string (not ODBC name)

    Hi,
    I havce a question regarding the use of a sub variable in SQL data loads as the data source. I find this works great when the variable is set to an existing ODBC. What I would really like to do is skip the ODBC creation step and have the substitution variable be the actual connection string, such as "Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase; Uid=myUsername;Pwd=myPassword;"
    Can anyone confirm or deny whether this functionality exists? As usual, the documentation is vague on the subject and doesn't exclude the possibility, but doesn't include it, either.
    Thanks!

    My first thought is that no, you can't do that. Even if you could, I'm not sure if you'd want to do that. The easiest way to find out is simply to try. But more than likely I think you should just have "hard-coded" values for the source/target server. If you are trying to stay with the same load rule for dev/test/prod servers, you might just be better off coming up with a naming scheme that let's you keep them all separate.
    Cheers,
    Jason Jones
    [http://www.jasonwjones.com]

Maybe you are looking for

  • Ipod nano, white screen of death

    my ipod nano4gb went to a white screen, still plays and i can update, but only a white screen, makes playback by menu memory a bit challenging. any event, went to Man Beach apple store for repair, booked a genius, spoke with buddy and a replacement i

  • Unable to print and scan from new wireless hp printer to Macbook Air

    I have just purchased a  wireless HP Deskjet 2540( compatible with MAC) and I am not able to print or scan anything on my Macbook Air,even after trying with the USB connection.I have installed and uninstalled the printer 3 times but still not working

  • Station Globals modified externally are not reflected

    Hi, I am having an UI developed in CVI(EXE1) which runs a teststand sequence. The flow of sequence is controlled by Station Globals. The Station Globals i am trying to control from another user interface so that the flow in EXE1 will be exrcised. But

  • T3ShutdownDef deprecated in WLS 6.1 SP5 ?

    After switching over from SP4 to SP5 of WebLogic Server 6.1 I get deprecation warnings when compiling my Shutdown Class implementing weblogic.common.T3ShutdownDef. Also other classes from weblogic.common are marked as deprecated (e.g. T3ServicesDef)

  • Oracle Enterprise Manager issues

    We are experiencing difficulties connecting to http://localhost:1158/em and also the ISQL link from the EM page when and if the EM console does manage to load. Problem 1 -: New Oralce 10G database installed ok no errors. Data imported from old Oralce