How to get a list of values used in the WHERE filter of stored procedures and functions in SQL Server

How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
How can get a list of values as shown (highlighted) in the sample stored procedure below?
ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
SELECT   [LOAN_ACCT].PROD_DT,
              [LOAN_ACCT].ACCT_NBR, 
              [LOAN_NOTE2].OFCR_CD, 
              [LOAN_NOTE1].CURR_PRIN_BAL_AMT, 
              [LOAN_NOTE2].BR_NBR,
INTO #Table1
FROM
                dbo.[LOAN_NOTE1],
                dbo.[LOAN_NOTE2],
                dbo.[LOAN_ACCT]
WHERE
                [LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
                and
                [LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
                and
                [LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
                and
                [LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
                and
                [LOAN_ACCT].PROD_DT = '2015-03-10'
                and
                [LOAN_ACCT].ACCT_STAT_CD IN
('A','D')
                and
                [LOAN_NOTE2].LOAN_STAT_CD IN
('J','Z')
Lenfinkel

Hi LenFinkel,
May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
For multiple values paramter you can use a
table-valued parameter. Then there's no problem getting the values.
If you could elaborate your purpose, we may help to find better workaround.
Eric Zhang
TechNet Community Support

Similar Messages

  • How to create a list of value using date?

    We need to create a list on a report. The list consists of date. I have tried several times, but no luck.

    Hi Charles,
    I guess you have a user-parameter in your report and you need to define the LoV for the user parameter, so that the user can select from the LoV. In such a case you get REP-0782 if the datatype of column does not match the LoV of the parameter. Eg, if you have a query like
    select * from employees where hire_date < :p_hire_date
    And you want to build an LoV for hire_date, do the following:
    1. Go to your user parameter > Property Inspector > Datatype > select "Date". If you select Character or Number, you will get REP-0782.
    2. Now double click List of Values, choose "Select Statement" and type something like
    select distinct hire_date from employees order by hire_date asc
    If you don't want to use a Select Statement to build the LoV, you can write a static list of values, and even in this case Step 2 above should avoid the error REP-0782.
    Navneet.

  • How can I get list of columns used of specific table in all stored procedure?

    How can I get used column list of a specific table in among all stored procedure?
    Suppose that,
    I have a table(VendorMaster) which has 100 columns just I want to know how many columns used in among all stored procedure.

    We have solved by below query...
    IF OBJECT_ID('tempdb.dbo.#SPDependencyDetails') IS NOT NULL
    DROP TABLE #SPDependencyDetails
    CREATE TABLE #SPDependencyDetails
     Or_Object_Database NVARCHAR(128)
    ,Or_Object_Name NVARCHAR(128)
    ,Ref_Database_Name NVARCHAR(128)
    ,Ref_Schema_Name NVARCHAR(128)
    ,Ref_Object_Name NVARCHAR(128)
    ,Ref_Column_Name NVARCHAR(128)
    ,Is_Selected BIT
    ,Is_Updated BIT
    ,Is_Select_All BIT
    ,Is_All_Columns_Found BIT
    DECLARE @database_name VARCHAR(100)
    DECLARE database_cursor CURSOR
    FOR
    SELECT name
        FROM sys.databases
        WHERE database_id =8
    OPEN database_cursor
    FETCH NEXT FROM database_cursor
    INTO @database_name
    WHILE @@FETCH_STATUS = 0 --Outer Loop begin
    BEGIN
        DECLARE  @WholeLotofSQL NVARCHAR(MAX) =       '
        DECLARE @object_name VARCHAR(150)
        ,@sqlstatement NVARCHAR(2500)
        DECLARE object_cursor CURSOR --Inner cursor, iterates list of objects that match type
        FOR
            SELECT name
                FROM '+@database_name+'.sys.objects AS o
                WHERE o.type = ''P'' --Change Object type to find dependencies of Functions, Views and etc.
                ORDER BY 1    
        OPEN object_cursor
        FETCH NEXT FROM object_cursor INTO @object_name
        WHILE @@FETCH_STATUS = 0  --Inner Loop Begin
            BEGIN
                SET @sqlstatement = ''USE '+@database_name+';
                                    INSERT INTO #SPDependencyDetails
                                    SELECT DB_NAME() AS Or_Object_Database
                                            ,'''''' + @object_name + '''''' AS Or_Object_Name
                                            ,CASE WHEN referenced_database_name IS NULL THEN DB_NAME()
                                                    ELSE referenced_database_name
                                            END AS Ref_Database_Name
                                            ,referenced_schema_name AS Ref_Schema_Name
                                            ,referenced_entity_name AS Ref_Object_Name
                                            ,referenced_minor_name AS Ref_Column_Name
                                            ,is_selected
                                            ,is_updated
                                            ,is_select_all
                                            ,is_all_columns_found
                                        FROM sys.dm_sql_referenced_entities(''''dbo.'' + @object_name + '''''', ''''OBJECT'''');''
                EXEC sys.sp_executesql @sqlstatement
                FETCH NEXT FROM object_cursor INTO @object_name
            END      
        CLOSE object_cursor
        DEALLOCATE object_cursor'
        EXEC sys.sp_executesql @WholeLotofSQL
        FETCH NEXT FROM database_cursor INTO @database_name
    END
    CLOSE database_cursor;
    DEALLOCATE database_cursor;
    SELECT Or_Object_Database as 'Database'
    ,Or_Object_Name as 'Procedure'
    ,Ref_Object_Name as 'Table'
    ,Ref_Column_Name as 'Column'
    FROM #SPDependencyDetails

  • How to get a global string value to be the value of a JSF output box?

    im useing Jdeveloper 10 i have made a JSF, JSP page i have a backing bean for that page. in there i have made a global value:
    private string test = "TESTING"these codes have been generated:
    public void setTester(HtmlOutputText outputText6) {
    this.tester = outputText6;
    public HtmlOutputText getTester() {
    return tester;
    }now how do i put test as the output text?

    That wouldn't even compile. HtmlOutputText isn't a subclass of String (heck, java.lang.String is a final class).
    Two ways to solve this: 1) use HtmlOutputText#setValue() in the constructor or initialization block of the bean or even by lazy loading in the getter. Just create a String getter and use it in the value attribute of the outputText element in the JSF page.

  • WarningAlert() how to get a preference key to use with the "Do not show again" checkbox

    Dear all
    I user WarningAlert() in aiuser.h to show alert for use. In this component have checkbox compoment.
    But I don't know method to get status of checkbox ?
    Could you tell me the method or solution to get value of checkbox compoment status, please.
    Thanks

    For those who are interested, I found the answer in the following thread:
    Cannot access PCD object from WD (DynPage works fine...)

  • How to find stored procedures and functions having SET Ansi_Nulls OFF?

    I have query below to find objects with ansi nulls ON. How can i find sql objects with ansi nulls off?
    SELECT
        SCHEMA_NAME(s.schema_id)  + '.' + s.name AS name,
        s.create_date,
        s.modify_date,
        OBJECTPROPERTY(s.object_id,'ExecIsAnsiNullsOn') AS ExecIsAnsiNullsOn
    FROM sys.objects s
    WHERE
        s.type IN ('P','FN')
        AND OBJECTPROPERTY(s.object_id,'ExecIsAnsiNullsOn') = 0
    ORDER BY SCHEMA_NAME(s.schema_id)  + '.' + s.name DESC

    I think my technet article on this topic will be helpful (check script at the end):
    SET
    ANSI_PADDING Setting and Its Importance
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Error while using DB Adapter in BPEL[Calling a procedure or function]

    Hi
    I am getting Error while executing the BPEL Process.
    1) I created a BPEL Process which uses a DB Adapter. I am using call a procedure or function. My Procedure is shown below. It takes a string a s input parameter and executes that string. I have used an assign activity to assign the input string.
    Procedure
    create or replace
    PROCEDURE SP_QUERY(s_string in varchar2)
    AS
    l_sql_stmt varchar2(1000);
    BEGIN
    l_sql_stmt := s_string;
    -- dbms_output.put_line( l_sql_stmt );
    EXECute immediate l_sql_stmt;
    commit;
    dbms_output.put_line('Executed' );
    -- if SQLCODE = 0 then
    --retCodeString := 'OK';
    --end if;
    END;
    I gave input string as "select * from tab", I have also tried a insert statement to a table in which its present in this database. But i am getting the following error.
    <3 Jun, 2013 9:42:25 AM IST> <Error> <oracle.webservices.service> <OWS-04115>
    Whats the Issue? Is the issue with the procedure or the BPEL process? Please help me out. I am stuck in this

    Hi,
    According to your message you have selected your procedure, but looks like the procedure is not having any reply or response parameter with it.
    Have you executed the procedure separately from SQL editor and see whether you are able to get the response or not ?
    If you get response, then how many columns are you getting ?
    Check the column names are matching with the schema file generated by adapter and see whether those column names are available as elements in .xsd file.
    Example provided below..
    In the below link, check the section "9.7 Stored Procedure and Function Support"
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_db.htm#CHDFBBCD
    Thanks,
    Vijay

  • How to Get a list of pending deferred tasks

    Hi all
    there is a bunch of unfinished threads here asking how to get a list/report of deferred tasks that are associated with user objects and scheduled for future execution.
    I need this list and I can't find out how to get it anyway.
    I don't care if it's a SJSIM report, a database query or a SJSIM log mining exercise.
    Does anyone know how to do this?
    My org has just gone live with SJSIM and I want to report on the number of legacy resource accounts that have had deferred tasks created against them for future disabling/deletion (our consultants added this workflow based on rules with an email warning, a disabling deferred task set for 2 weeks from now and a deleting deferred task for 6 months after that). Hopefully I can say "look, 5,000 legacy accounts are going to be cleaned up!
    Thanks in advance

    You can do it with a custom workflow, something like this:
         <Activity>
            <Action id='0' class='com.waveset.session.WorkflowServices'>
              <Argument name='op' value='queryObjectNames'/>
              <Argument name='type' value='User'/>
              <Argument name='attributes'>
                 <list>
                        <new class='com.waveset.object.AttributeCondition'>
                           <s>deferredTaskDate</s>
                           <s>isPresent</s>
                        </new>
                  </list>
               </Argument>
            <Action id='1' process='Check User'>
              <Iterate for='currentUser' in='queryResult'/>
              <Argument name='accountId' value='$(currentUser)'/>
            </Action>
         </Activity>And:
           <WFProcess name='Check User'>
             <Variable name='accountId' input='true'/>
             <Activity id='0' name='start'>
               <Transition to='Check User'/>
             </Activity>
             <Activity id='1' name='Check User' hidden='true'>
               <Action id='1' name='Get User View' application='com.waveset.session.WorkflowServices'>
                 <Argument name='op' value='getView'/>
                 <Argument name='type' value='User'/>
                 <Argument name='id' value='$(accountId)'/>
                 <Argument name='authorized' value='true'/>
               </Action>
               <Transition to='Got One'>
                   <notnull>
                           <ref>view.accounts[Lighthouse].properties.tasks[Legacy Cleanup].date<ref>
                    </notnull>
                 </Transition>
                 <Transition to='end'/>
              </Activity>
              <Activity id='2 name='Got One'>
                 <ActionResult name='users' type='message' overwrite='false'>
                    <ref>accountId</ref>
                  </ActionResult>
              </Action>
              <Transition to='end'/>
            </Activity>
         </WFProcess>This just gives a rough idea of how it can be done. It might be best to bring your consultants back in to implement this.
    Edited by: PaulHilchey on Feb 25, 2009 10:35 AM

  • How to get Document Set property values in a SharePoint library in to a CSV file using Powershell

    Hi,
    How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi,
    According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
    I suggest you can get the document sets properties like the PowerShell Command below:
    [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
    $siteurl="http://sp2013sps/sites/test"
    $listname="Documents"
    $mysite=new-object microsoft.sharepoint.spsite($siteurl)
    $myweb=$mysite.openweb()
    $list=$myweb.lists[$listname]
    foreach($item in $list.items)
    if($item.contenttype.name -eq "Document Set")
    if($item.folder.itemcount -eq 0)
    write-host $item.title
    Then you can use Export-Csv PowerShell Command to export to a CSV file.
    More information:
    Powershell for document sets
    How to export data to CSV in PowerShell?
    Using the Export-Csv Cmdlet
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • In OS 10.7.5, how do I get a listing of folders similar to the "directory tree" that I used to have when I was suffering through MS-DOS?

    In OS 10.7.5, how do I get a listing of folders similar to the "directory tree" that I used to have when I was suffering through MS-DOS?

    I'm not quite sure what it is you are looking for, but there are a three different ways to view the files and folder in a directory in Finder - Icon view, List view, or Column view - or you can use Terminal and use the various options for the ls UNIX command for listing a directory. For those options, see:
    https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/ls.1.html
    Hope this helps.
    Regards.

  • Check list field values using LINQ

    I have to check if the CURRENT USER is already in the list USERS by comparing his AccountName to the list field ACCOUNTNAME.
    If the USER is on the list I have to check if the field IsFollower is YES or NO and change it according to some conditions.
    I think LINQ would be the correct way of doing this but I have no clue how to do that.
    Any ideas pls, thanks

    Hi,
    Yes, you can query the list using LINQ.
    You need to get the SPList Object firstly, and then you can query list item value using LINQ.
    More information about how to check list field value using LINQ:
    http://msdn.microsoft.com/en-us/library/office/ee538250(v=office.14).aspx
    http://www.wolfsys.net/query-sharepoint-lists-with-linq/
    http://geekswithblogs.net/TanviBlog/archive/2013/06/06/linq-in-sharepoint-and-querying-list-items.aspx
    More information about how to use Server Object Model in SharePoint lists:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.aspx
    http://msdn.microsoft.com/en-us/library/office/ms456030(v=office.14).aspx
    Best regards

  • How to get a list of every application on my computer?

    I'm trying to figure out how to get a list of every application on my computer using applescript. I know it is possible for the system to do this, as evidenced by the dialog you get when you use the "choose application" function. Other examples are doing a spotlight search for "kind:app" or programs like Namely or QuickSilver.
    Is there a way to do this in applescript? The only solution I've come up with so far is to use the command:
    <pre>set everyapplicationaliases to choose application as alias with multiple selections allowed</pre>
    and manually select all on the resulting dialog. I can then take the results and go from there, however there are a few significant problems with this approach.
    1. It requires user interaction. (I have an idea for some future applications that could use this functionality if it can be done without user input.)
    2. It's horribly slow. As a test run I choose all the applications from the dialog, extracted some basic info and put the result on the clipboard. It took a couple of minutes to complete this relatively basic task. In comparison, running the aforementioned spotlight search took maybe ten seconds.
    Thanks in advance!
    best,
    peter

    For these specific queries my results are...
    set appList to paragraphs of (do shell script "mdfind \"(kMDItemKind = 'application'c) || (kMDItemKind = 'widget'c)\"")
    3082
    set appList to paragraphs of (do shell script "mdfind \"(kMDItemKind = 'Application'c) || (kMDItemKind = 'Widget'c) ||
    ((kMDItemContentTypeTree = 'com.apple.application') && (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard))\"")
    3115
    I think I finally found some numbers that make sense!
    When I search for Kind:Application by the Command+F method in the Finder, I get a total of 2521 items, of which 2477 are "Applications" and 44 are "Other".
    (Just by eyeballing it, "Other" seems to include some Classic Apps and some .bundle files.)
    The total # found by this method (2521) plus the number of Widgets found using mdfind (318) equals the number of total number of items found by spotlight (2839).
    I also noticed that these numbers almost equal the spotlight number:
    mdfind results for kMDItemKind:
    Widgets: 318
    Applications: 1684
    Classic*: 795
    and
    Command+F "Other" items: 44
    3181684+79544 = 2841
    It may be a fluke that this is so close to the 2839 spotlight gives, or maybe there's an overlap somewhere...
    Tying this back into my initial question, it seems like the original mdfind command for Applications is probably the best answer for what I was looking for,
    since I wasn't really thinking about Classic apps and Widgets anyway.

  • How can I get a list of active savepoints for the current session?

    Hi,
    In Oracle Applications, we are getting the following error while performing ROLLBACK to a Savepoint.
    "Unexpected Error: ORA-01086: savepoint 'PTNR_BULK_CALC_TAX_PVT' never establishe d ORA-06510: PL/SQL: unhandled user-defined exception"
    So how can I get a list of active savepoints for the current session?
    Could you please also let me know if there is any better way to debug this issue.
    Appreciate any quick response as the issue is very critical.
    Thanks,
    Soma

    user776523 wrote:
    Hi,
    In Oracle Applications, we are getting the following error while performing ROLLBACK to a Savepoint.
    "Unexpected Error: ORA-01086: savepoint 'PTNR_BULK_CALC_TAX_PVT' never establishe d ORA-06510: PL/SQL: unhandled user-defined exception"It sounds like there's an execution path in the code where the SAVEPOINT is never issued.
    There is no way to get a list of active savepoints. Is this your code or a "canned" procedure? If it is your code you can go through the code looking for answers, possibly tracing execution using DBMS_OUTPUT.PUT_LINE or writing messages to a log table. If its a "canned" procedure you may need to open an SR with Oracle

  • How to get inputtext's inputvalue by using javascript

    how to get inputtext's inputvalue by using javascript?
    and how to judge whether its be filled or empty string

    Why do you want to use javascript..? Why not action listener..? You can check whether its an empty string by checking
    if(str != null && !str.equals("")) {..}
    where str is the variable for inputText value.
    If this is not helpful, do provide more details on which version of JDev you are using and what are you trying (your usecase).
    regards,
    ~Krithika

  • List of Values using WeCheckbox

    I attempted to apply the same principles in using shared variables within a subreport to populate the values for WeCheckbox function. Although I was able to get the list of values to populate as desired, something strange happened when I tried to use the name of the variable within WeBuilder function. When I referenced the exact variable, it doesn't show up on the report. However, if I just use "Checkbox" in the WeBuilder function, everything displays perfectly. The obvious problem is that I can't capture the selected checkbox with a Submit button, as it never displays that it is capturing the user selected checkbox when passing parameters to the target report. Is it possible to use a list of values to populate the WeCheckbox function and also be able to pass the values to a target report?

    hello Eric,
    i am not sure if i understand the issue. can you please change the WEBuilder's debugging mode to "2" so that it will display the url that it is generating...what is the url that is being generated and what is wrong with the particular url when the end user selects a checkbox and presses submit?
    jw

Maybe you are looking for

  • Excel VBA to JS: How does one pass rectangle coordinates to a JS function.

    I have an Excel VBA sub that calls a folder level JS function and I'm trying to pass a set of rectangle coordinates. This is the VBA code: Sub BarcodeDoc_PDF417(pdfFileName As String)     Dim AVDoc As Acrobat.CAcroAVDoc     Dim PDDoc As Acrobat.CAcro

  • After updating to maverick, Illustrator CS6 will not open. How can I fix this.

    Illustrator boots up then crashes. I have tried the font fixes and I tried a java fix and nothing has worked for me. I also can not install the Adobe Updates. Found the problem solution was found on this thred: https://discussions.apple.com/message/2

  • Easy Cost Planning - Passing info down the hierarchy

    Is it possible in Easy Cost Planning to pass characteristics down the hierarchy for use lower down. For example, enter the dimensions at the top level and have them passed down for use in calculations lower down the hierarchy? Thanks Graham

  • New iPhone coming in Feb

    HI. While in LA last week I heard that Apple are bringing out a new iPhone in Feb with a much bigger memory. Does anyone know if this is true as I intend to get one for Christmas and would rather wait for the bigger memory so I can watch movies on it

  • Logic old bug in MIDI import

    I've had this weird issue regarding importing midi files for a very long time. I reported the bug to the Logic Pro Feedback several times but nothing is changed. If I import this MIDI file in Logic http://dl.dropbox.com/u/2723724/test.mid the first t