Convert SQL Server ROW_NUMBER() OVER(PARTITION BY() Query to Access

Hi,
I am having trouble with converting this SQL Server query to Access. If anyone can give me help I would appreciate it.
SELECT B.AMOUNT_REQUESTED, B.INIT_OFF, B.MBR_NBM, B.STATUS, B.APPLICATION_NBR
FROM
SELECT AMOUNT_REQUESTED, INIT_OFF, MBR_NBM, STATUS, APPLICATION_NBR, ROW_NUMBER() OVER(PARTITION BY MBR_NBM ORDER BY MBR_NBM) RN
FROM LOAN_DATA
WHERE APPLICATION_DATE BETWEEN '20150420' AND '20150425'
) B
WHERE RN = 1
ORDER BY B.MBR_NBM

While there is no equivalent to ROW_NUMBER(), it appears that you are just wanting the first row of each group, and that CAN be accomplished in Access, but I do wonder why you would WANT to do that in Access if your data is stored in SQL Server.  As
Tom indicated a Pass Through query object is likely your best bet -- or a View in SQL Server, then create a Linked Table object that points to it.
To get the first of each group ... which is essentially a TOP n, where n = 1 ... so .. the first thing you will want to indentify is a second field to use as a Key in order to define the "first" row you want in the group.  In your SQL
statement, you are ordering my mbr_nbm, so the secondary sort is unknown -- likely predicable, but unknown with out knowledge of the schema ... so, I will provide samples by using APPLICATION_DATE as the sort key.
This one is the "first" of a series with the assumption that the one you want is the one with the "biggest"/"most recent" APPLICATION_DATE. 
SELECT vLoanData.AMOUNT_REQUESTED, vLoanData.INIT_OFF, vLoanData.MBR_NBM, vLoanData.STATUS, vLoanData.APPLICATION_NBR
FROM LOAN_DATA As vLoanData
INNER JOIN
(SELECT MBR_NBM, Max(APPLICATION_DATE) As LastAppDate
FROM LOAN_DATA As vLast
GROUP BY MBR_NBM) As vLastApp ON vLoanData.MBR_NBM = vLastApp.MBR_NBM And vLoadData.APPLICATION_DATE = vLastApp.LastAppDate
Or ... the following is a TOP n query where n = 1.
SELECT vLoanData.AMOUNT_REQUESTED, vLoanData.INIT_OFF, vLoanData.MBR_NBM, vLoanData.STATUS, vLoanData.APPLICATION_NBR
FROM LOAN_DATA As vLoanData
WHERE (vLoanData.MBR_NBM & '|' & vLoanData.APPLICATION_DATE)
IN (SELECT TOP 1 (vCorrelated.MBR_NBM & '|' & vCorrelated.APPLICATION_DATE) As Key
FROM LOAN_DATA As vCorrelated
WHERE vCorrelated.MBR_NBM = vLoanData.MBR_NBM
ORDER BY vCorrelated.MBR_NBM, vCorrelated.APPLICATION_DATE DESC)
This second example is not going to win you any points with respect to speed, but is truly a closer model to the TOP N type thing you are doing in SQL Server.
Hope that helps!
Brent Spaulding | Access MVP

Similar Messages

  • How to convert SQL Server hierarchical query (CTE) to Oracle?

    How to convert SQL Server hierarchical query (CTE) to Oracle?
    WITH cte (col1, col2) AS
    SELECT col1, col2
    FROM dbo.[tb1]
    WHERE col1 = 12
    UNION ALL
    SELECT c.col1, c.col2
    FROM dbo.[tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
    DELETE a
    FROM dbo.[tb1] AS a INNER JOIN cte AS b
    ON a.col1 = b.col1

    See: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2129904
    Ah, just spotted it's a delete statement - you won't be able to do it using subquery factoring in Oracle.
    I had a go at trying to convert for you, but notice that you reference the cte from inside the cte... I can only assume you have a table called cte too...
    DELETE FROM dbo.tb1
    WHERE col1 = 12
    OR col2 IN (SELECT col1 FROM cte)
    Edited by: Boneist on 22-Jun-2009 09:19

  • How can use row_number() over partition by plz provide some doc.

    row_number() over (partition by)
    what is this and how can use it in sql query.
    if ur have any documentation of it. plz give...me..
    thanx sir
    thanx in advance.

    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions105a.htm
    SELECT empno, deptno,
    row_number() over (partition by deptno order by empno) rn
    from scott.emp
         EMPNO     DEPTNO RN                                    
          7782             10     1
          7839             10     2
          7934             10     3
          7369             20     1
          7566             20     2
          7788             20     3
          7876             20     4
          7902             20     5
          7499             30     1
          7521             30     2
          7654             30     3
          7698             30     4
          7844             30     5
          7900             30     6Regards
    Dmytro

  • Issue with ROW_NUMBER() OVER (PARTITION)

    Hi,
    Please read the Thread completely, I have created a Report to see Yearly Turnover%, The report works fine but when I take Quarter and Months in it, it restricts the result to only 1 line(i.e., my first year's Turnover) and when I opened the Physical query, I saw the BI Server is using
    ROW_NUMBER() OVER (PARTITION BY)
    which is not at all necessary.
    *I tried disabling WITH_CLAUSE_SUPPORTED and PERF_PREFER_MINIMAL_WITH_USAGE but didn't get any resolution, Could anybody help me out?
    thanks in Advance,
    Anand

    You said 'it restricts the result to only 1 line' means the value is nor drill down to next level?
    In that case Yearly Turnover% is set to Year level?

  • Issue with  OBIEE ROW_NUMBER() OVER (PARTITION BY)

    Hi All,
    I am facing some issue with the ROW_NUMBER() OVER (PARTITION BY function in the query that is being generated. I am currently on version 11.1.1.6. I have 1 FACT and 1 Dimension table. Within the dimension I have create a level based hierarchy namely REGION -> GROUP - DIVISION etc. Now the problem is that the OBIEE automatically applies *"ROW_NUMBER() OVER (PARTITION BY T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.REGION_DESC ORDER BY T9.PRODUCT_TYPE_DESC ASC, T130.DIVISION_DESC ASC, T130.REGION_DESC ASC) "
    to the query where in it is not required at it returns with 3 different row numbers. If i remove this line and the where clause I am able to get correct results however its not working whatever I do in the RPD. Please advise.
    WITH
    SAWITH0 AS (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6
    from
    (select sum(T157.PL_GRAND_TOTAL) as c1,
    sum(T157.TRANSACTION_AMT) as c2,
    T130.DIVISION_DESC as c3,
    T130.REGION_DESC as c4,
    T130.GROUP_DESC as c5,
    T9.PRODUCT_TYPE_DESC as c6,
    ROW_NUMBER() OVER (PARTITION BY T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.REGION_DESC ORDER BY T9.PRODUCT_TYPE_DESC ASC, T130.DIVISION_DESC ASC, T130.REGION_DESC ASC) as c7
    from
    DIM_ALL_MODULES_REF T9,
    DIM_MIS_TREE_REF T130,
    DIM_DATE_SERIES T123,
    FCT_ALL_MODULES_TRANS T157
    where ( T9.SGK_MIS_ID = T130.SGK_MIS_ID and T9.SGK_MODULE_ID = T157.SGK_MODULE_ID and T123.SGK_TIME_ID = T157.SGK_TIME_ID and T123.TRANS_DATE between TO_DATE('2011-01-01 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2011-03-31 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') )
    group by T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.GROUP_DESC, T130.REGION_DESC
    ) D1
    where ( D1.c7 = 1 ) ),
    SACOMMON42934 AS (select T130.DIVISION_DESC as c2,
    T130.REGION_DESC as c3,
    T130.GROUP_DESC as c4,
    T9.PRODUCT_TYPE_DESC as c5,
    sum(T258.BEG_NMK_EQ_COST_AMT) as c6,
    T123.TRANS_DATE as c7,
    sum(T258.END_NMK_EQ_COST_AMT) as c8
    from
    DIM_ALL_MODULES_REF T9,
    DIM_MIS_TREE_REF T130,
    DIM_DATE_SERIES T123,
    FCT_MODULES_BEG_END_BAL T258
    where ( T123.SGK_TIME_ID = T258.SGK_TIME_ID and T9.SGK_MIS_ID = T130.SGK_MIS_ID and T9.SGK_MODULE_ID = T258.SGK_MODULE_ID and T258.PRODUCT_TYPE_ID = 2 and T123.TRANS_DATE between TO_DATE('2011-01-01 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2011-03-31 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') )
    group by T9.PRODUCT_TYPE_DESC, T123.TRANS_DATE, T130.DIVISION_DESC, T130.GROUP_DESC, T130.REGION_DESC),

    Hi Dhar,
    Thanks for replying back. But the ROW_NUMBER thing is inserted with the "WITH SUPPORTED" clause only but that is something which are the default settings. However, I notice that ROW_NUMBER() OVER (PARTITION BY) lines are erratic and are not consistent. So sometimes the drill works properly when no ROW_NUMBER() OVER (PARTITION BY) is generated but other times data is wrong. I am not sure why this behaviour is erratic even though I select the same values.
    This is surely a product problem as the condition where c7 = 1 filters the result and does not take into account all values.
    Even when I do not use WITH_SUPPORTED clause the stitch does not happen properly. Please advice if this is ever going to be by Oracle or any work around for this?
    Thanks

  • ROW_NUMBER() OVER (PARTITION

    hi, can anyone explain, especially this part
    ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
    Thanks
    newbie
    SELECT A.TNP_TRACK_ID, A.USER_ID, NVL(A.DELETED,0) DELETED, A.CREATE_TIME, A.DELETE_TIME, B.PRODUCT_CODE, C.LOGIN_NAME,
    ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
    FROM MISPNA.TNP_TRACKABLE_' || TO_CHAR(p_reporting_month, 'YYYYMM') || ' A
    JOIN TMP_VRZ_LATEST_SOC B ON A.TNP_TRACK_ID = B.TRACK_ID
    JOIN MISPNA.TN_LOGIN C ON A.USER_ID = C.USER_ID
    WHERE A.DELETED<>1

    Hi,
    949523 wrote:
    thank you very much, the whole original script is
    SELECT TNP_TRACK_ID, USER_ID, DELETED, CREATE_TIME, DELETE_TIME, PRODUCT_CODE, LOGIN_NAME
    FROM (
    SELECT A.TNP_TRACK_ID, A.USER_ID, NVL(A.DELETED,0) DELETED, A.CREATE_TIME, A.DELETE_TIME, B.PRODUCT_CODE, C.LOGIN_NAME,
    ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
    FROM MISPNA.TNP_TRACKABLE_' || TO_CHAR(p_reporting_month, 'YYYYMM') || ' A
    JOIN TMP_VRZ_LATEST_SOC B ON A.TNP_TRACK_ID = B.TRACK_ID
    JOIN MISPNA.TN_LOGIN C ON A.USER_ID = C.USER_ID
    WHERE A.DELETED <>1
    WHERE RN != 1';I assume the single-quote near the end is just an editing typo.
    >
    so seems like with specified user_id, it will pick greatest tnp_track_id ? ( as it asks RN=1)That's what it would be doing if the last line read
    WHERE  rn = 1; for each user_id, that query (with = on the last line) would display all the SELECTed values from the row with the greatest tnp_track_id.
    Since you're using != , however, then it's doing just the opposite; it's displaying all rows except the row with the greatest tnp_track_id.
    The sub-query is necessary here. All analytic functions, including ROW_NUMBER, are evaluated after the WHERE clause has been applied. To use the results of an analytic function in a WHERE clause, you have to compute the function in a sub-query first.
    Edited by: Frank Kulash on Jan 7, 2013 8:08 PM
    Just noticed you're saying "WHERE RN != 1" ( not equals)

  • Qualify row_number over(Partition by col order by col) and char2hexint() functions in informatica

    How to implement qualify row_number over(Partition by col order by col) and char2hexint in informatica in a way that is supported by pdo?
    Apart from sql overriding or using stored procedure ,is there any other solution?Can rank transformation help here? ....But, I guess rank transformation cannot be pushed down..
    help please !

    Hi Saichand,
    The links were helpful. But i am not getting how it is working in test and not in live.
    I found one difference while deploying . The column names of the object both in Test and Production had spaces.For E.g: Full Name
    When this column Full Name is pulled to the repsository in test , it automatically put double quotes for the column names in the physical sql when it hits the database.
    But, In production , when I pulled the column the report gave error as Invalid Identifier since OBIEE generated column name as Full Name without double quotes.
    Then I changed the column in Phyiscal Layer repository by having double Quotes for all columns. Afte that report worked fine.
    Whether this has caused any issue in Row Partition.
    Is there any setting to have column name in Double Quotes ?
    Thanks,
    Johnny

  • Issue while accessing a SQL Server table over OTG

    Hi,
    I have been learning oracle for about 1.5 years and am just starting to learn some OTG pieces. I am wondering about an issue. The issue is:
    "We need help with an issue we are having while accessing a SQL Server table over OTG. We are getting the following error message in Oracle :
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC SQL Server Driver]Unicode conversion failed {HY000}
    The column it is failing on is "-----------" in the view --------------- in the SQL Server database pointed to by the Oracle DB Link ------------------- thats created in the Oracle instances ---- and -----.
    This was working before, but is now failing, we suspect its due to new multi-byte data being added to the base table in the above column."
    I took out the details and added ---- instead. I am wondering your guys thoughts on fixing this issue and helping me learn along the way. Thanks

    Hi Mike,
    Thanks for the response, here are the details:
    1. What is the character set of the Oracle RDBMS being used. What is returned by -
    select * from nls_database_parameters;
    NLS_CHARACTERSET
    AL32UTF8
    NLS_NCHAR_CHARACTERSET
    UTF8
    We get SQL_Latin1_General_CP1_C1_AS and 1252 as Collation Property and Code Page
    The datatype of the column in question in SQL Server is nvarchar(100).
    When I do a describe on the SQL Server view ( desc CK_DATA_FOR_OPL@------- ), I get the error below;
    ERROR: object CK_DATA_FOR_OPL does not exist
    Select * from CK_DATA_FOR_OPL@------ where rownum =1 does get me a row.
    create table tmp_tab as
    Select * from CK_DATA_FOR_OPL@----- where rownum =1;
    desc tmp_tab shows the datatype of the said column in the table created in Oracle as NVARCHAR2(150).
    Not sure why a column defined with size 100 in SQL Server should come across as 150 when seen over OTG. We see something similar in DB2 tables we access over OTG as well.
    Edited by: 993950 on Mar 15, 2013 8:49 AM

  • Converting SQL server database into SAP readable XML??

    Could anyone kindly let me know what is the procedure to convert SQL server database into SAP readable (encrypted) XML for SAP Authoring tool???

    Sorry you will need to be more specific, what is it exactly you want to do? What authoring tool do you mean.
    A bit more info and someone might be able to help you.
    BRgds,
    Simon

  • After upgrade from SQL Server to SQL server 2012 I cannot show Query Designer ?? Please help

    Hi
    I have installed the required .Net software, but never the less I've got this message. Could you please help me out ?
    Thanx in advance
    Pia 
    TITLE: Microsoft SQL Server Management Studio
    Cannot show Query Designer.
    ADDITIONAL INFORMATION:
    Exception has been thrown by the target of an invocation. (mscorlib)
    Unable to find the requested .Net Framework Data Provider.  It may not be installed. (System.Data)
    BUTTONS:
    OK

    also check
    http://connect.microsoft.com/VisualStudio/feedback/details/652192/visual-studio-2010-add-connection-fails
    mostly machine.config is referring to .net 3.0 assemblies
    Balmukund Lakhani
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog |
    Team Blog | @Twitter
    | Facebook
    Author: SQL Server 2012 AlwaysOn -
    Paperback, Kindle

  • Convert SQL server database into SAP readable (encrypted) XML for SAP tool?

    Could anyone kindly let me know what is the procedure to convert SQL server database into SAP readable (encrypted) XML for SAP Authoring tool???

    So If I understood it correctly there an existing propriertory question bank with SQL server. You are looking at an option to migrate all the tests and questions from the existing system to the LSO system. Right ?
    I am still not clear on the xml conversion. Have you guys found a solution which could be achieved through a xml file ?
    am not aware of a way through which you could import only a xml file and create tests/questions. If you have a sample xml file then forward me so that I could do some testing on my end.As per my knowledge you could do one of the following. I
    1. Create the tests and questions manually in Authoring Environment. It will be a time consuming task. Based on the number of questions you have you might have to assemble a team of content developers to acheive this.
    2. Alternatively, you could create a Adobe Flash based assessment. The Flash component would be the front-end and will read from a xml file to display the questions and to drive the funcationality. This would be a easier and less time consuming than creating the assessments manually in authoring environment. However, you might miss out some of the functionality available in the Test Author of Authoring Environment unless you have all the functionality replicated inside Flash. This would require one time effort in creating the Flash template and the xml file structure. Once that is created you could create multiple assessments by just replacing the xml file. If you select this approach then you would have to ensure the data from SQL is converted in the desired xml format required by your Flash component.
    Please let me know if you require any further guidance or clarification regarding this.
    Regards,
    Ravi Sekhar

  • Error converting SQL Server DDL and views to Oracle

    I am trying to convert SQL Serve 2008 on windows to Oracle 11g using SQL Developer 3.2.20.09. I am using the jtds-1.2.7 drivers to connect to SQL Server.
    I have made several attempts to run the conversion and am getting the tables, indexes, and triggers converted with no issue. However, my Procedures and views are not coming across. All of them are giving similar errors as:
    "Failed To Convert Stored Procedure get_compvision > esp3.dbo.get_compvision:unexpected end of subtree: Line 0 Column 0"
    When I log into the source SQL Server environment using SQL Developer, I get an empty SQL Editor window with "null" when I try to {right-click -> "Open"} on the Procedure.
    Logging into SQL Server Administrator as the same user I can see the source code, so the issue appears to be related to SQL Developer and not my user privleges. I am a dbo alias in SQL Server.
    In addition, if I click on a view, I can see the data and metadata, but not the SQL that defines the view. I see tabs for column, data, triggers, and details.
    In addition, if I go to the "capture" for my Migration project and drill down to procedures, I can see them listed, but each and every procedure gives me a "/* DDL not accesible */" error. I get teh same results for views, triggers and indexes.
    Can someone help me? I have been googling for days!
    Edited by: user4714217 on Jan 24, 2013 12:54 PM

    SELECT v.vnd_c, CASE v.use_parent_addr_flg WHEN 0 THEN a.str_1 ELSE pa.str_1 END AS str_1,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.str_2 ELSE pa.str_2 END AS str_2,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.str_3 ELSE pa.str_3 END AS str_3,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.city ELSE pa.city END AS city,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.state ELSE pa.state END AS state,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.zipcode ELSE pa.zipcode END AS zipcode,
    CAST((CASE v.use_parent_addr_flg WHEN 0 THEN (CASE a.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END)
    ELSE (CASE pa.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END) END) AS char(1)) AS foreign_flg,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.country ELSE pa.country END AS country,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.cre_d ELSE pa.cre_d END AS cre_d,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_d ELSE pa.mod_d END AS mod_d,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_by ELSE pa.mod_by END AS mod_by
    FROM dbo.om_vendor AS v LEFT OUTER JOIN
    dbo.om_address AS a ON a.vnd_id = v.vnd_id AND a.addr_c = 1 INNER JOIN
    dbo.om_owner AS o ON v.owr_id = o.owr_id INNER JOIN
    dbo.om_address AS pa INNER JOIN
    dbo.primary_vendors AS pv ON pa.vnd_id = pv.vnd_id ON o.part_id = pv.part_id
    WHERE (pa.addr_c = 1)
    WHICH TRANSLATES TO
    SELECT v.vnd_c ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_1
    ELSE pa.str_1
    END str_1 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_2
    ELSE pa.str_2
    END str_2 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_3
    ELSE pa.str_3
    END str_3 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.city
    ELSE pa.city
    END city ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.STATE
    ELSE pa.STATE
    END STATE ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.zipcode
    ELSE pa.zipcode
    END zipcode ,
    (CASE v.use_parent_addr_flg
    WHEN 0 THEN (CASE a.foreign_flg
    WHEN 1 THEN 'Y'
    ELSE 'N'
    END)
    ELSE (CASE pa.foreign_flg
    WHEN 1 THEN 'Y'
    ELSE 'N'
    END)
    END) foreign_flg ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.country
    ELSE pa.country
    END country ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.cre_d
    ELSE pa.cre_d
    END cre_d ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.mod_d
    ELSE pa.mod_d
    END mod_d ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.mod_by
    ELSE pa.mod_by
    END mod_by
    FROM om_vendor v
    LEFT JOIN om_address a
    ON a.vnd_id = v.vnd_id
    AND a.addr_c = 1
    JOIN om_owner o
    ON v.owr_id = o.owr_id
    JOIN om_address pa
    JOIN primary_vendors pv
    ON pa.vnd_id = pv.vnd_id
    ON o.part_id = pv.part_id
    WHERE ( pa.addr_c = 1 );
    Edited by: user4714217 on Jan 24, 2013 1:43 PM

  • How to convert sql server database to SQL Server Express LocalDB??

    How do I convert sql server database 2008 to SQL Server Express LocalDB??
    Thanks
    Aru

    Hello,
    Please read the following article:
    http://msdn.microsoft.com/en-us/library/hh873188.aspx
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to convert sql server procedure in to plsql procedure

    hi guys
    i have requirement where in i have to convert sql server procedure into plsql procedure.
    can some one help me out .
    thanks,
    Vamshi.D

    Hi Vamshi,
    As you want to convert sql server procedure in to plsql procedure
    i.e SQL SERVER ->ORACLE Right
    FYI
    SQL SERVER Proc. Syntax are totally different as compared to ORACLE Proc.
    So, better you study Logic of SQL-SERVER Proc and convert into
    Oracle Procedure.
    Thanks,
    Samadhan

  • Converting SQL Server Query to Oracle

    Hello TechFriends,
    Can any one of u please tell me equivalent of following SQL Server Query?
    The same query runs in Oracle but givesa same reocrds in different order!! I want such an equivalent oracle query that gives records in same order as Sql Server does.
    select
    ProfValue_ProfScaleFK ProfScale,
    ProfValue_Value ProfValue,
    isnull(ProfValueDesc.name, ProfValue_name) ProfName
    from
    ProfValueDesc inner join TBL_LMS_Lang
    on lang_fk = lang_pk and langid = 'en'
    right outer join ProfValue
    on ProfValue_ProfScaleFK = ProfScale_fk and ProfValue_Value = ProfValue_FK ;
    Regards & TIA.
    Anand.

    If you want a specific ordering why don't you add an ORDER BY clause?
    Donal

Maybe you are looking for