Write SQL for LOV for linked tables

I have two tables:
tblRegions (Parent Table)
Region ID (Primary Key, sequence, trigger) =100
Region Code (Unique Key) = LA
Region (Unique Key) = Latin America
tblCompanies (Child Table)
Company ID (PK, sequence, & trigger) = 600
Company Code (Unique Key) = ABC
RegionLU (Foreign Key, Select List)
Company = ABC Distributing
Country = New Zealand
I want "RegionLU" to be a select list in form called frmCOMPANIES and allow me to look up "tbl.Regions.Region". I want the list sorted in ascending order. What SQL Statement would I write in the LOV I create? I have no programming background, so please be detailed. Thanks.

are you in the correct forum? isn't this an Application-Express-Question ?

Similar Messages

  • How to create a DSN-less connection to SQL Server for linked tables in Access

    hey
    i cant understand how i use that Function
    if that information what you need
     stLocalTableName: dbo_user_name
    stRemoteTableName: user_name
    stServer :sedo2015.mssql.somee.com
    stDatabase :sedo2015
    stUsername :sedo_menf_SQLLogin_1
    stPassword :123456789
    how will be that Function??
    please write that Function to me
    '//Name : AttachDSNLessTable
    '//Purpose : Create a linked table to SQL Server without using a DSN
    '//Parameters
    '// stLocalTableName: Name of the table that you are creating in the current database
    '// stRemoteTableName: Name of the table that you are linking to on the SQL Server database
    '// stServer: Name of the SQL Server that you are linking to
    '// stDatabase: Name of the SQL Server database that you are linking to
    '// stUsername: Name of the SQL Server user who can connect to SQL Server, leave blank to use a Trusted Connection
    '// stPassword: SQL Server user password
    Function AttachDSNLessTable(stLocalTableName As String, stRemoteTableName As String, stServer As String, stDatabase As String, Optional stUsername As String, Optional stPassword As String)
    On Error GoTo AttachDSNLessTable_Err
    Dim td As TableDef
    Dim stConnect As String
    For Each td In CurrentDb.TableDefs
    If td.Name = stLocalTableName Then
    CurrentDb.TableDefs.Delete stLocalTableName
    End If
    Next
    If Len(stUsername) = 0 Then
    '//Use trusted authentication if stUsername is not supplied.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";Trusted_Connection=Yes"
    Else
    '//WARNING: This will save the username and the password with the linked table information.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";UID=" & stUsername & ";PWD=" & stPassword
    End If
    Set td = CurrentDb.CreateTableDef(stLocalTableName, dbAttachSavePWD, stRemoteTableName, stConnect)
    CurrentDb.TableDefs.Append td
    AttachDSNLessTable = True
    Exit Function
    AttachDSNLessTable_Err:
    AttachDSNLessTable = False
    MsgBox "AttachDSNLessTable encountered an unexpected error: " & Err.Description
    End Function

    thanks more thanks for you
    look i add that code in form
    it worked but i cant add recored  why ??
    Private Sub Form_Open(Cancel As Integer)
    Call AttachDSNLessTable("dbo_user_name", "user_name", "sedo2015.mssql.somee.com", "sedo2015", "sedo_menf_SQLLogin_1", "123456789")
    End Sub

  • SQL for join table  problem?

    hi morning,
    my problem also haven find out the solution,can help me solve.
    I got one part of register student to exam,during that part is like that.
    Student Code:________(table3)
    Exam Code:_________(table 3)
    Student Name:________(table 1)
    Exam Name:_________(table 2)
    I can write code call table 3 but when three table join together in part 3,got problem is come out alry....The problem is inside the Student Name & Exam Name.When i use the button for NEXTRECORD to check record,cannot call the student Name & exam Name.
    Thank for help. Because i use sql code to call table 3 to check table1 and table 2 detail ,then retrive that data.
    my code is like that,
    private void cmd_NexRec_RSEActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    int i;
    i=0;
    try{
    String x1,x2;
    x1=(jTextField10.getText()).trim();
    x2=(jTextField11.getText()).trim();
    if (x1.equals("")&& x2.equals("") )
    counter.studentExam="R";
    counter.registerStudentExam="N";
    i++;
    jInternalFrame8.setVisible(false);
    Connection con = getConnection2();
    Statement s = con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs=getStudentExams();
    ResultSet rs1=getCodes();
    ResultSet rs2=getExams();
    String select="select * from studentExamFile a LEFT JOIN {studentData b} ON a.student_code=b.student_code LEFT JOIN {exam c} ON c.exam_code=a.exam_code where student_code='"+ x1 +"' and exam_code='"+ x2 +"'" ;
    // String select ="select * from studentExamFile , exam , studentData where studentExamFile.student_code=studentData.student_code and exam.exam_code=studentExamFile.exam_code ";
    // rs = s.executeQuery(select);
    rs.next();
    StudentExam c=getstudentcode(rs);
    Code c1=getCode(rs1);
    Examcode c2=getexamcode(rs2);
    jTextField12.setText(c.studentcode);
    jTextField13.setText(c.examcode);
    jTextField14.setText(rs.getString("c1.name"));
    jTextField15.setText(rs.getString("c2.ename"));
    // jTextField14.setText(c1.name);
    // jTextField14.setText(c2.ename);
    jLabel16.setText("Record: Review");
    jInternalFrame10.setVisible(true);
    jTextField12.setEnabled(false);
    jTextField13.setEnabled(false);
    //New Line
    jTextField14.requestFocus();
    else
    Connection con = getConnection2();
    Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    String w=(jTextField10.getText()).trim();
    String w2=(jTextField11.getText()).trim();
    //String select= "select * from [studentExamFile] where [student_code]>'" w "'";
    // String select1="select * from [studentExamFile] where [exam_code]>'" w2 "'";
    String select="select * from studentExamFile a LEFT JOIN {studentData b} ON a.student_code=b.student_code LEFT JOIN {exam c} ON c.exam_code=a.exam_code where student_code='"+ x1 +"' and exam_code='"+ x2 +"'" ;
    ResultSet rs;
    rs = s.executeQuery(select);
    // rs = s.executeQuery(select1);
    rs.next();
    if(rs.isFirst())
    counter.registerStudentExam="N";
    jInternalFrame8.setVisible(false);
    jTextField12.setText(rs.getString(1));
    jTextField13.setText(rs.getString(2));
    jLabel16.setText("Record: Review");
    jInternalFrame10.setVisible(true);
    jTextField12.setEnabled(false);
    jTextField13.setEnabled(false);
    //New Line
    jTextField14.requestFocus();
    counter.studentExam="R";
    else
    JOptionPane.showMessageDialog(this,"End of the file ","Infomation",JOptionPane.INFORMATION_MESSAGE);
    }catch(SQLException e)
    System.out.println("Error");
    //jTextField3.requestFocus();
    }

    thanks for reply.
    i think my problem is in connection to database .
    String sql="select studentData.student_name, exam.exam_name from studentData,exam,studentExamFile where studentData.student_code=studentExamFile.student_code and exam.exam_code=studentExamFile.exam_code ";
                    // String sql="select studentData.student_name , exam.exam_name from studentExamFile  LEFT JOIN { studentData }  ON studentExamFile.student_code=studentData.student_code LEFT JOIN { exam }  ON exam.exam_code=studentExamFile.exam_code ";
                     Connection con = getConnection();
                     Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                     Connection con2 = getConnection();
                     Statement s3 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                     System.out.println("error");//my problem inside here....help me
                     rs3=s.executeQuery(sql);
                     rs3=s3.executeQuery(sql);
                     rs3.next();
                     String s1,s2;
                     s1=rs3.getString(1);//maybe me dunno how to convert the sql data...
                     s2=rs3.getString(2);
                     rs.next();
                     rs2.next();
                    // rs3.next();
                     Code c=getCode(rs);
                     Examcode c2=getexamcode(rs2);
                     StudentExam c3=getstudentcode(rs3);
                     jTextField12.setText(c3.studentcode);
                     jTextField13.setText(c3.examcode);
                    // jTextField14.setText(rs.getString("c.name")); 
                     //jTextField15.setText(rs.getString("c2.ename"));
                     jTextField14.setText(s1); 
                     jTextField15.setText(s2);
                     jLabel16.setText("Record: Review");
                     jInternalFrame10.setVisible(true);
                     jTextField12.setEnabled(false);
                     //New Line
                     jTextField14.requestFocus();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL for fragmented tables

    Hello,
    Can someone give me the sql to determine what tables and or tablespaces are say 15% fragmented? I'm on Oracle 9i.
    thanks...

    Are you using locally managed tablespaces? If so, you can stop worrying about tablespace fragmentation, particularly if you are using UNIFORM extents.
    Can you define "table fragmentation"? I'm hard-pressed to figure out how a table can be fragmented.
    Assuming you need to worry about fragmentation in the first place, either because you are still using dictionary managed tablespaces or because you have "table fragmentation" for some definition of the term, can you define what you mean by percentage fragmentation? If you have a dictionary managed tablespace, it is not obvious what it would mean to have a tablespace that was 15% fragmented.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Write sql for plsql record

    im trying to builde plsql table like given below
    ids               nme
    1     ICOL$
    2     CON$
    3     UNDO$
    4     PROXY_ROLE_DATA$
    5     FILE$
    6     UET$
    7     IND$
    8     SEG$
    9     COL$
    10     CLU$then trying to get value for ids 5 is FILE$ but it's not working as expected. please find the code below.
    declare
    type v_ty is record
    ( ids  array,
      nme array_char);
    v_r  v_ty;
    v_ids number;
    begin
    select rownum idx ,table_name tnme
    bulk collect into v_r
    from user_tables
    where rownum < 11;
    select b.column_value into v_ids
    from table(v_r.ids) a , table(v_r.nme) b
    where a.column_value = 5;
    end;thanks
    Raj
    Edited by: user13397097 on Jan 2, 2013 12:46 AM

    user13397097 wrote:
    dose it not bring down the context switch between plsql and sql engine ?Well if you manage to do the data modification in a single SQL query, that would be 1 context switch.
    In your case there is at least 2 of them.
    Moreover : You seems to be fighting against context switch. Did you identify that as being the bottleneck in your processing ?
    The basic example of costly context switch is calling a PLL/SQL function in a where clause when you could do it purely in SQL. In that cas the main SQL does a context switch on each row tested, and if the PL/SQL function is actually doing SQL inside, that is another "nested" context switch.
    Doing so on a million rows would "hurt" performance wise.

  • How to write SQL for this query

    Hi, All
    I have table which sample data are shown below
    CLM_NO. CLM_RUN PARTY PAY_CD
    2006213103246      2006085483      PA010193 3CO11
    2006213103246      2006085483 PA010193 3CO17
    2006213103246      0000000000 PA084113 2CO11
    2006213103246      0000000000 PA000001 2RK11
    2006213103246      0000000000 PA082822 3CO11
    2006213103270      0000000000 PA000001 2RK11
    2006213103270      0000000000 PA032456 3CO11
    for each clm_no , if data only have zero the report must show pay_cd minimum value(2RK11) but when clm_run have both zero and nonzero data the report will show minimum pay_cd of record that have clm_run nonzero data(3CO11)
    Thank you
    Mcka

    Hi Mcka
    Based on the example you have provided, we should have only the following two rows in the final result:
    CLM_NO. CLM_RUN PARTY PAY_CD
    2006213103246 2006085483 PA010193 3CO11
    2006213103270 0000000000 PA000001 2RK11
    The first line is displayed because even though there are 6 rows for CLM_NO 2006213103246, with a combination of zero and non-zero CLM_RUNS, we need to display the non-zero row containing the minimum PAY_CD.
    The second line is displayed because both rows have a zero CLM_RUN and we need to display the row which has the lowest PAY_CD.
    If this understanding sounds right to you then you need to create the following condition:
    RANK() OVER(PARTITION BY CLM_NO ORDER BY CLM_RUN DESC, PAY_CD ASC) = 1
    Can you follow what this is doing?
    Basically, for each CLM_NO, identified by the clause PARTITION BY CLM_NO, we are ranking the combination of CLM_RUN and PAY_CD where the CLM_RUN is sorted in high to low order and the PAY_CD is sorted in low to high order. This will cause Discoverer to allocate an ascending range of numbers starting with 1, where 1 corresponds to the row you are looking for. If we create a condition such that this whole expression equals 1 then we must display only the rows that you want, with one row being displayed per CLM_NO.
    Note: This works so long as the same CLM_NO cannot have two or more different CLM_RUN numbers where one of the higher CLM_RUNs has a lower PAY_CD than the other non-zero CLM_RUNs.
    It also makes the assumption that for a given non-zero CLM_RUN there will not be two or more identical PAY_CDs. If this condition can exist then you could exclude duplicate values from the report. If you have never done this there is a checkbox called Hide Duplicate Rows on the Layout tab of the Edit Worksheet Dialog box.
    Best wishes
    Michael

  • Generate script for filling table

    Hi all,
    I've got table at test Oracle server table1 with columns ID, BTYPE, MYDESCRIPTION. Rows of this table have been inserted manually. Now my need is to write script for creating table (structure + data). I think about writing something like
    CREATE TABLE table 1
    AS
    SELECT 1 AS ID, 'TYPE1' AS BTYPE, 'SOME TEXT' AS MYDESCRIPTION
    UNION ALL
    SELECT 2 AS ID, 'TYPE2' AS BTYPE, 'SOME TEXT 2' AS MYDESCRIPTION
    But rows are too many to type... Could you please suggest some way of generating script for creating table at working server using existing table at test server? The problem is I don't have an access to working server.
    Thanks ahead.

    Use the view user_tab_cols
    say
    declare
    cursor c1 is
    select 'e_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'DEPARTMENTS'
    union
    select 'd_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'EMPLOYEES';
    v1 varchar2(500);
    begin
    v1 := 'create table new_tabl (';
    for i in c1 loop
    v1 := v1||i.col||',';
    end loop;
    v1 := substr(v1,1,length(v1)-1);
    dbms_output.put_line(v1||')');
    end;
    /i am using employees and departments table of hr schema.
    now as both the tables have some column column so i have used e for employees and d for departments
    just do one thing remove the length for date data type in o/p i dont know why it is not working.
    this will give you structure for data use any sql stmt
    Edited by: 810345 on Jun 9, 2011 9:58 PM

  • Help with Sql for Annual Report per month

    Hi, I have been given the task to create an annual report by month that would show company's profits per month and totals in the last column to show which branch had the hightest income.
    Branch||January||February||March||April||May||June....||Total||     
    ABC ||$0.00 ||$0.00 ||$0.00||$0.00||$0.00||$0.00||Total Amt||
    DEF ||$18.01 ||$3.88 ||$18.01||$4.12||$18.01||$3.97||Total Amt||
    Can anyone please help me in giving an idea of how to write sql for this report..? I am building sub-queries for everymonth by giving the dates for Jan/Feb/March..but I think this is not the right way to do this....
    SELECT
    sum(a.commission) December,
    sum(b.commission) November
    FROM
    Select
    c.account_id,
    c.officer,
    c.account_product_class_id,
    sum(c.dp_monthly_premium) Commission
    From
    contract c
    Where
    c.account_id=109 and
    c.status='APPROVED' and
    c.protection_effective between '01-DEC-2009' and '31-DEC-2009'
    Group by
    c.account_id,
    c.officer,
    c.account_product_class_id
    ) a,
    Select
    c.account_id,
    c.officer,
    c.account_product_class_id,
    sum(c.dp_monthly_premium) Commission
    From
    contract c
    Where
    c.account_id=109 and
    c.status='APPROVED' and
    c.protection_effective between '01-NOV-2009' and '30-NOV-2009'
    Group by
    c.account_id,
    c.officer,
    c.account_product_class_id
    ) b
    I always have hight hope from this forum. So please help. Thanks in advance.
    Edited by: Aditi_Seth on Jan 26, 2010 2:29 PM

    You may try a group report on one simple query like:
    Select
    c.account_id, c.officer, to_char(c.protection_effective, 'MM') month
    sum(c.dp_monthly_premium) Commission
    From
    contract c
    Where
    c.status='APPROVED' and .....
    Group by
    c.account_id
    c.officer,
    to_char(c.protection_effective, 'MM')
    break/gropu on account_id, c.officer, to_char(c.protection_effective, 'MM') and total will be automatically calculated by Reports.

  • No archivng objects for these tables???

    Hi Frends,
    Could you please offer me some help on how can I go ahead in archiving these the following tables as I dont find any archiving objects? Do we have any delete program or write program for thse tables in order to archive these table without using SARA transaction???
    S601
    S602
    S605
    S606
    S607
    S608
    S610
    Thanks,
    Shamim

    Hi Shamim,
    All the programs are generated automatically when you use MCSX. The archive object will gets created with name MC_* and you have to do rest of the customizing.
    The program names will start with RMCA<NNN><Sequence No> for e.g.
    RMCA9521                       Archiving Statistical Data from Info Structure S952
    RMCA9522                       Delete Archived Statistical Data from Info Structure S952
    RMCA9523                       Reload archived statistical data from info structure S952
    RMCA9525                       Editing Statistical Data in Info Structure S952
    Also I think there will be no dependecies to these table.
    Hope this helps.
    Thanks
    Lakshman

  • How to write sql query for counting pairs from below table??

    Below is my SQL table structure.
    user_id | Name | join_side | left_leg | right_leg | Parent_id
    100001 Tinku Left 100002 100003 0
    100002 Harish Left 100004 100005 100001
    100003 Gorav Right 100006 100007 100001
    100004 Prince Left 100008 NULL 100002
    100005 Ajay Right NULL NULL 100002
    100006 Simran Left NULL NULL 100003
    100007 Raman Right NULL NULL 100003
    100008 Vijay Left NULL NULL 100004
    It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
    I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains  both left_leg and right_leg id, then it is called pair.)
    I know there are three pairs under id "100001" :-
    1.  100002 and 100003
    2.  100004 and 100005
    3.  100006 and 100007
        100008 will not be counted as pair because it does not have right leg..
     But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
    Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005

    Sounds like this to me
    DECLARE @ID int
    SET @ID = 100001--your passed value
    SELECT left_leg,right_leg
    FROM table
    WHERE (user_id = @ID
    OR parent_id = @ID)
    AND left_leg IS NOT NULL
    AND right_leg IS NOT NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to create services for sql querry with joint 2 tables ?

    Hi all,
    I start to learn the php services function for mysql querry in flex 4.5 and all seam to be ok.
    But i don't find anny help or tutorial to create service that call a sql querry with joint to tables, like this :
    Select table01.fieldA table02.fieldA WHERE table01.fieldC LIKE table02.fieldC
    Are there a way to do that in flashBuilder creation services interfaces, or not ?
    Does we make a special value Object and all the AS3  classes and not use the template opperations ?
    Thank's for your help or link
    fbm

    Hi Fabien,
    I'm afraid you'll have to learn a bit more about PHP...
    Joined tables is a relational database feature. It has nothing to do with PHP, and PHP has nothing to do with Flex...
    The "magic" of the flex framework is that it can plug itself into any backend (.Net, Java, PHP...)
    The new way Flash Builder interacts with PHP is through AMF (Actionscript Messaging Format) with the help of Zend and Zend_Amf. You've been able to do it on your own for a while, but it was a bit tricky to set up... The new IDE helps you doing those mapping with wizards. What it does is that it serializes and deserializes objects from PHP to Actionscript, and also generates Actionscript value objects.
    So what you'll have to do is to write your own PHP services to retrieve your data from joined tables in MySQL. Those services will return simple arrays. Then start the wizard, select your services. Flash Builder will then map the objects contained in the PHP arrays into Actionscript typed objects.
    I suggest you have a deep look into Zend_Tables...
    Hope it'll help.
    Julien.

  • View for a network node or link table

    Can a view be used for a nework node or link table? The process sdo_net.validate_network hangs when I try to validate a network based on views for the node and link tables.

    I am using a logical model. The sql statement (checking link/node relationship) that hangs is:
    select count(a.link_id) from vlinks a
    where not exists
    select * from vnodes b
    where b.node_id = a.start_node_id or b.node_id = a.end_node_id
    I gather there is a concurrency issue with my links view because it joins a table with itself. I have a link table that has the start and end nodes defined on two records. Here is my view script:
    create or replace view vlinks
    (link_id, link_name, start_node_id, end_node_id, link_type, active, link_level, cost, parent_link_id)
    as
    select a.id, 'Link '||a.id, a.nodeid, b.nodeid, 'simple', 'Y',1,0,''
    from vnodes a, vnodes b
    where a.seq=1 and b.seq>1 and a.id = b.id
    I can create tables from my views and validate them successfully through sdo_net.validate_nodes_schema, sdo_net.validate_links_schema, and sdo_net.validate_network.
    I can analyze the network model through the Java API using the reachable nodes, shortest path, and spanning tree methods without any problems.
    I guess I'll validate my view links by counting the total number of links and subtracting the number of links joined successfully at the start and end nodes - if 0 then all links are valid. E.g.:
    select count(link_id) from
    select link_id from vlinks
    minus
    select a.link_id from vlinks a, vnodes b, vnodes c
    where a.start_node_id = b.node_id
    and a.end_node_id = c.node_id

  • Defining Dimensions, Attribute Hierarchies for a Link Table(Many to Many)

    I have 3 Tables in the Database
    Table 1: Transactions (Fact Table) - PK(TransactionId)
    Table 2: Relationship (Dimension1) - PK(Relationship Id), FK_TransactionId, FK_CompanyId, RelationshipType
    Table 3: Companies (Dimension 2) - PK(CompanyId)
    Table 2: Relationship table is a link table between Transactions & Companies to facilitate many to many relationship. 
    I defined Fact and Dimension tables accordingly but having issues defining Dimension & Attributes for Relationship tables
    Relationship Dimension:
    I have 3 hierarchy groups defined
    Hierarchy 1 - Relation -Relationship Type,Relationship Id(PK)
    Hierarchy 2 - Transaction - Transaction, Relationship Id(PK)
    Hiearchy 3 - Company - CompanyId, Relationship Id(PK)
    Defined the attribute relationship in the following way
    RelationshipID(PK) ---> CompanyId , RelationshipID(PK) ---> TransactionId, RelationshipID(PK)
    ---> RelationshipTYpe
    I am getting incorrect results when I deploy the cube. Not all the types are being displayed only 4 types are being displayed out of 27 types though there exists Transactions for all the Types.
    To fix the incorrect results, I tried to break the Relationship Dimension into 2 dimensions seperating Transaction(Relationship Dim) & Company,Type (Companies Dim). I tried to configure a many
    to many Relationship type between my  Companies Dim & Fact Table Transaction. But I get the error that says 
    "Companies Dim many to many dimension in the Tansaction measure group requires that the granularity of the Relationship dimension is lower than that of the Relationship measure group "
    Any help regarding how to difine Dimensions & Attribute Hierarchies on a Many to many link table is appreciated.

    Hi Jaya,
    According to your description, you are experiencing the issue when implement many to many relationship by using a bridge table in your SQL Server Analysis Services project, right?
    Generally, a bridge table will have a surrogate key for the dimension and a surrogate key to the fact table or a degenerate dimension based on the fact table. Here are some blogs which describe how to implement many to many relationship using a bridge
    table.
    http://bifuture.blogspot.com/2011/06/ssaskimball-modeling-nm-relation.html
    http://www.sqlchick.com/entries/2012/1/22/data-modeling-tip-when-using-many-to-many-bridge-tables-in-s.html
    http://social.technet.microsoft.com/wiki/contents/articles/22202.a-practical-example-of-how-to-handle-simple-many-to-many-relationships-in-power-pivotssas-tabular-models.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to write a create method for a table Not null fields

    Hi all,
    I have a table with four columns,
    process
    prs_seqid NUMBER(4) NOT NULL,
    prs_sbs VARCHAR2(2) NOT NULL,
    prs_name VARCHAR2(64) NOT NULL,
    description VARCHAR2(128)
    Where prs_seqid is primary key and prs_sbs is foreign key.
    I tried to create a CMP bean for this table. I am unable to write a record in table while I can read
    Records from table. These are the create methods
    public Long ejbCreate() throws CreateException {
    return null;
    public Long ejbCreate(Long newPrs_seqid, String newPrs_sbs, String newPrs_name) throws CreateException {
    prs_seqid = newPrs_seqid;
    newPrs_sbs = prs_sbs;
    prs_name = newPrs_name;
    return null;
    public void ejbPostCreate() {
    public void ejbPostCreate(Long newPrs_seqid, String newPrs_sbs, String newPrs_name) {
    When I run the client code �home.create(pk, "AB", "ABC");�
    It throws
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: Transaction aborted (possibly due to transacti
    on time out).; nested exception is: javax.transaction.RollbackException; nested
    exception is:
    javax.transaction.RollbackException
    java.rmi.RemoteException: Transaction aborted (possibly due to transaction time
    out).; nested exception is: javax.transaction.RollbackException; nested exceptio
    n is:
    javax.transaction.RollbackException
    javax.transaction.RollbackException
    <<no stack trace available>>
    In log file I got
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at com.sun.ejb.persistence.PersistenceManagerImpl.createRow(PersistenceManagerImpl.java:630)
         at com.sun.ejb.persistence.PersistenceManagerImpl.storeRow(PersistenceManagerImpl.java:412)
         at com.sun.ejb.persistence.PartitionImpl.ejbStore(PartitionImpl.java:555)
         at com.telesenskscl.processes.ProcessesBean_PM.ejbStore(ProcessesBean_PM.java:103)
         at com.sun.ejb.containers.EntityContainer.callEJBStore(EntityContainer.java:1581)
         at com.sun.ejb.containers.EntityContainer.enlistResourcesAndStore(EntityContainer.java:868)
         at com.sun.ejb.containers.EntityContainer.beforeCompletion(EntityContainer.java:853)
         at com.sun.ejb.containers.ContainerSynchronization.beforeCompletion(ContainerSynchronization.java:65)
         at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:48)
         at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:108)
         at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2289)
         at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:233)
         at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:208)
         at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:386)
         at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:208)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:434)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1460)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1278)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:397)
         at com.telesenskscl.processes.ProcessesBean_PM_RemoteHomeImpl.create(ProcessesBean_PM_RemoteHomeImpl.java:41)
         at com.telesenskscl.processes._ProcessesBean_PM_RemoteHomeImpl_Tie._invoke(Unknown Source)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
         at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
         at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
         at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
    javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at com.sun.ejb.persistence.PersistenceManagerImpl.createRow(PersistenceManagerImpl.java:630)
         at com.sun.ejb.persistence.PersistenceManagerImpl.storeRow(PersistenceManagerImpl.java:412)
         at com.sun.ejb.persistence.PartitionImpl.ejbStore(PartitionImpl.java:555)
         at com.telesenskscl.processes.ProcessesBean_PM.ejbStore(ProcessesBean_PM.java:103)
         at com.sun.ejb.containers.EntityContainer.callEJBStore(EntityContainer.java:1581)
         at com.sun.ejb.containers.EntityContainer.enlistResourcesAndStore(EntityContainer.java:868)
         at com.sun.ejb.containers.EntityContainer.beforeCompletion(EntityContainer.java:853)
         at com.sun.ejb.containers.ContainerSynchronization.beforeCompletion(ContainerSynchronization.java:65)
         at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:48)
         at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:108)
         at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2289)
         at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:233)
         at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:208)
         at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:386)
         at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:208)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:434)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1460)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1278)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:397)
         at com.telesenskscl.processes.ProcessesBean_PM_RemoteHomeImpl.create(ProcessesBean_PM_RemoteHomeImpl.java:41)
         at com.telesenskscl.processes._ProcessesBean_PM_RemoteHomeImpl_Tie._invoke(Unknown Source)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
         at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
         at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
         at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    Please help me ASAP. Thanks in advance

    I found problem was with my code. I wrote
    newPrs_sbs = prs_sbs; instead of
    prs_sbs = newPrs_sbs;
    This solves my problem
    Thanks to all.....

  • Can I use Microsoft SQL Server Management Studio version 11.0 to write SQL queries for "SQL Server Compact 4.0 Local Database"

    Hi, Can I use Microsoft SQL Server Management Studio version 11.0 to write SQL queries for "SQL Server Compact 4.0 Local Database" ?
    When I use Connect Object Explorer, the "Connect to Server" dialog box which pops up has only 4 selections in the Server Type Drop Down List. They are Database Engine, Analysis Services, Reporting Services & Integration Services. I have read
    somewhere that there should be a compact database option. but I do not see it.
    What I would like to do is use free form SQL Queries against the tables in "SQL Server Compact 4.0 Local Database" .
    Once I have validated these queries, then I will use them in my Visual Studio 2012 C#, ASP.NET application. I created the Local Database using Visual Studio 2012 for use by my application.
    Thank you for your help..
    diana4

    Hello,
    With SSMS 2005 we have had the Option to work with SQL CE database files, but not with higher Version of SSMS.
    You can use the free SQL CE Toolbax instead; see
    http://sqlcetoolbox.codeplex.com/
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for

  • RW-00023: Error:  DBC file was not created- When try to install 11i on OEL5

    I got an erorr in the appl-top log file as below, also my installation wizard showing post installation checks did not succeed. Please advice.....:-) DBC File Check RW-00023: Error: - DBC file was not created: File = /d01/oracle/visappl/fnd/11.5.0/se

  • SPS upgrade from 18 to 21 due to Windows 7 and IE 8 Release

    Hi Guys, Our client has decided to upgrade their user's OS from Windows XP to Windows 7. Also the IE will be upgraded to IE8. We did an impact analysis with a single system for the BW front end. Except a few minor errors, nothing serious troubled the

  • IPhone as GPS receiver for Wi-Fi iPad

    As you sadly know there is no such feature, the iphone hotspot provides ONLY internet. what other options are available? 1. buy BT GPS receiver in addition? which one is best? 2. Apps? Please share and let me know how did you overcome this. [it's rea

  • Can I adjust the sorting of Podcast as displayed on the IPOD itself

    Itunes by default sorts my podcast with the newest podcast at the top. If I want to redisplay the sorting within iTunes, I just click on the release date column and they re-sort with the oldest at the top. This doesn't change the way they sort in the

  • How to unregister an Lr 6 upgrade?

    I purchased an Lr 6 upgrade because I had Lr5.   Now I have decided to go CC with Lr and Ps.    How do I unregister my Lr 6 upgrade serial number in my Adobe account so that I can give it to our niece who has LR 5?   I have already uninstalled the Lr