SQLPS - Checking for a specific table

I am trying to check for a table existence in each database.  Any ideas why this does not work?
Import-Module
"sqlps" -DisableNameChecking
$SQLServer
= "wobdslezberg2"
Set-Location
SQLSERVER:
$dbArray
= Get-ChildItem
-name -Exclude
"tempdb*",
"master*",
"model*",
"msdb*" |
Sort-Object
foreach ($DatabaseName
in $dbArray)
$instance =
$DatabaseName
#write-host  $instance
if (test-path
"SQLSERVER:\SQL\wobdslezberg2\DEFAULT\Databases\$instance\Tables\eConfig") {write-host
"exists"}
else {write-host
"not exists"}

I am trying to iterate through all the databases on the server and check for the existence of a specific table in each database. 
Actually that line does work fine because if I comment out the if test-path line, I get results as expected.  and I get list of tables like this
dbo.SRC04_TABLES
How do I put in the schema (dbo) in the test-path?
The test-path does not seem to work as I get this message
Test-Path : Cannot retrieve the dynamic parameters for the cmdlet. SQL Server PowerShell provider error: The number of keys specified does not match the number of keys required to address this object. The number of keys required are: Name.
At line:19 char:9
+     if (test-path "SQLSERVER:\SQL\wobdslezberg2\DEFAULT\Databases\$instance\Tabl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Test-Path], ParameterBindingException
    + FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.Commands.TestPathCommand
Thanks
Scott

Similar Messages

  • Performance check for status control table

    Hi,
    When ever we activate any ODS or delete the request ,a message 'Performance Check for Status control Table ' appears.
    What does it mean?Please explain what is status control table and how it performs?
    Thanks & Regards,
    Dinakar.

    Hi,
    This message is not a issue in itself. It is just a SAP message which means that the system is checking/updating the system tables to carry out the operation whether it can be done or not.
    If your loads are failing at this step or after this message there can be many reasons, check some of  the possible reasons below
    Performing check and potential update for status control table
    Update from PSA error in Process Chain
    problem in deleting request
    Reporting not available ,even if Data is sucessfully loaded into DT
    Hope this helps,
    Kush kashyap

  • How do I set a BG Image for a specific Table Cell?

    Hello...
    How do I set a Background Image for a specific table cell
    without it affecting the main page background image?
    thanks
    J

    Use CSS -
    td.special { background-image:url(foo.gif); }
    will style this table cell only -
    <td class="special">
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "JSloanSDRE" <[email protected]> wrote in
    message
    news:g2dl7n$pf5$[email protected]..
    > Hello...
    >
    > How do I set a Background Image for a specific table
    cell without it
    > affecting the main page background image?
    >
    > thanks
    > J

  • Error while running query for a specific table

    Hi All,
    I need your help please.
    I've configured everything correctly in my SCCM environment. And i used to connect the CAS database from a separate box(same domain) which has SSMS console installed in it. Now the problem is, whenever i try to run a query in CAS database locally, it runs
    successfully. But when i connect the CAS database remotely and run the same query with the same login i used in CAS, it says the below error. This is happening from past 2 days only. :'(
    Query ran :
    select top 100 * from v_GS_WORKSTATION_STATUS
    Error :
    Msg 18456, Level 14, State 1, Line 1
    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
    OLE DB provider "SQLNCLI11" for linked server "abc.domain.com" returned message "Invalid connection string attribute".
    I checked the SQL connection authentication information it says authenticated by kerberos using below query :
    SELECT 
        s.session_id
      , c.connect_time
      , s.login_time
      , s.login_name
      , c.protocol_type
      , c.auth_scheme
      , s.HOST_NAME
      , s.program_name
    FROM sys.dm_exec_sessions s
      JOIN sys.dm_exec_connections c
        ON s.session_id = c.session_id
    where s.host_name='servername'
    Result:
    136 2015-01-30 17:50:29.277 2015-01-30 17:50:29.280 domain\user TSQL KERBEROS servername Microsoft SQL Server Management Studio
    But, another wierd information is i can successfully run the below query in remote.
    select * from vSMS_R_System
    I think that specific table is not working in remote. Pleaseeeeeeee helppp me......
    Regards,
    Jay

    Hi JaySmiley,
    According to your description, you get the logon issue when connecting to CAS database remotely and execute query. Right?
    In this scenario, this error can happen when the SPN account is registered without setting 'trusted for delegation' property. Account must be trusted for delegation in order for Kerberos delegation to succeed. Here's a blog talking about your scenario, please
    refer to the link below:
    http://blogs.technet.com/b/umairkhan/archive/2013/10/19/the-distributed-views-do-not-get-created-in-configmgr-2012-sp1-because-of-the-login-issue.aspx
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Checking for a specific shared printer

    I have a script that adds shared printers to a print server by passing arguments into it via a CSV file.  This normally works fine, but I need to validate that the printers actually got created afterwards, so I'm attempting via powershell to check for
    the existence of a printer on a specific print server.
    I've read another thread that has partway lead me down the path I think I need. What that has given me thus far is the following:
    gwmi win32_printer -filter "name='PrinterName'"
    2 issues with this.  When I run this from the prompt it shows information for the printer in question then seems to hang rather than return to the prompt.  The data returned is: Location, Name, PrinterState, PrinterStatus, Sharename, & SystemName,
    then this is where it hangs.  When I cancel via <CTRL+C> I get the following:
    Get-WmiObject : Out of memory
    At line:1 char:5
    + gwmi <<<< win32_printer -filter "name='PrinterName'"
    + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
    So I'm not certain how to deal with the 'hang' & subsequent error.  Also I really want to reach a Boolean type of value where I can have the scripts take action on whether its there or not.  So that the code would follow the following logic:
    Check for Printer1 on ServerA
    If Printer1 exists on ServerA - do This
    If Printer1 does NOT exist on ServerA - do something else
    Any assistance appreciated!
    # When I wrote this script only God & I knew what I was doing.
    # Now, only God Knows!
    don't retire technet http://social.technet.microsoft.com/Forums/en-US/e5d501af-d4ea-4c0f-97c0-dfcef0192888/dont-retire-technet?forum=tnfeedback

    Hi Wasisname,
    In addition, to solve System.OutOfMemoryException error, please try to configure the memory for Windows PowerShell:
    set-item wsman:localhost\Shell\MaxMemoryPerShellMB 2048
    Reference from:
    Learn How to Configure PowerShell Memory
    If you have any feedback on our
    support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support  

  • Authorization check for a program/table

    Hi ,
    Can anyone help me out in
       How to do authorization check for an abap program and also a table.
       I have no idea about the authorizations.
    My requirement is that I need to do the authorization check in such a manner that only users having a certain profile
    1. should be able to execute the program
    2. View of the entries of the table.
    Thanks & Regards,
    Keerthi

    Hello Keerhi ,
    I got you wrong at first!
    If you want to have only certain users to be able to do certain operations, then you need to assign the appropriate roles to those users!
    First find the role
    second add the user in the role ( PFCG T code---> USers tab)
    Raj

  • Check for data in table

    So i have a table with one column:
    SUMA_LEI
    LEI
    I have a form made for this table. My purpose is to have just on row for this table, so when the user gets to the form page of this table, it gets an error like: "delete previous value, then insert new one". For this I need to make a pl/sql process that checks if there is a row inserted in the table and if that is the case, then I get an error, if not, im allowed to continue on that page.
    I need some help as soon as possible if you can please help me. I know that I need some "if clause", but beyond that I don't know how to do it

    A possible solution is create a materialized view and then a check constraint on the materialized view: this should work in a multiuser environment.
    Example:
    SQL> drop table t;
    Table supprimee.
    SQL>
    SQL> create table t (
      2  x integer,
      3  y varchar2(10)
      4  );
    Table creee.
    SQL>
    SQL> CREATE MATERIALIZED VIEW LOG on t
      2  WITH ROWID (x, y)
      3  including new values;
    Journal de vue materialisee cree.
    SQL>
    SQL> CREATE MATERIALIZED VIEW t_mv
      2  REFRESH FAST ON COMMIT AS
      3  SELECT count(*) cnt
      4  FROM t;
    Vue materialisee creee.
    SQL>
    SQL> ALTER TABLE t_mv
      2  ADD CONSTRAINT chk check(cnt<=1);
    Table modifiee.
    SQL>
    SQL> insert into t values(1,'Ok');
    1 ligne creee.
    SQL> commit;
    Validation effectuee.
    SQL>
    SQL> insert into t values(2,'KO');
    1 ligne creee.
    SQL> commit;
    commit
    ERREUR a la ligne 1 :
    ORA-12008: erreur dans le chemin de regeneration de la vue materialisee
    ORA-02290: violation de contraintes (TEST.CHK) de verification

  • Checking for data in tables

    hi gurus,
    i have an itab which has fi transactional data , which inlcudes glaccounts with the name belnr.
    now i need to check if each glaccount has a master data , if a match is not found that glaccounts must be stored to display later.
    so i thought of doing this way, is it a best practise to do this way.
    tables: skb1.
    data : i_skb1 like skb1 occurs 0 with header line.
    data:begin of i_saknr occurs 0,
    saknr like skb1-saknr,
    end of i_saknr.
    loop at itab.
    select single * from skb1 into i_skb1 where saknr EQ itab-belnr.
    if sy-subrc <> 0.
    i_saknr-saknr = itab-belnr.
    append i_saknr.
    endif.
    endloop.
    is there a better way of doing this.

    Sanjana,
    Do like this
    tables: skb1.
    data : i_skb1 like skb1 occurs 0 with header line.
    types:begin of ty_saknr,
    saknr like skb1-saknr,
    end of ty_saknr.
    data: i_saknr type table of ty_saknr,
            wa_saknr type ty_saknr.
    select * from skb1 into table i_skb1 for all entries in itab where saknr EQ itab-belnr.
    loop at itab into wa.
    read table itab into wa with key saknr = wa-belnr.
    if sy-subrc <> 0.
    wa_saknr-saknr = wa-belnr.
    append wa_saknr to i_saknr.
    endif.
    endloop.
    Regards,
    Satish

  • Error Message for a Specific Table Cell

    Hello All,
    I created a table were one column is defined as an input field.  This field needs to be validated against certain rules.  When validation fails, I want to highlight just the cells that are in error.  The way I have it coded now, when validation fails, all the cells under that column show as if there is an error in all the cells even though only one cell is in error.
    Below is the way I have it coded. This method is performed in a loop, so the element has the index number.
    Thanks in advance for all your help.
    Mike
    public int getZstk_Stock_NomsSoawaamt(IPrivateStockNominationsCust.IZstk_Stock_NomsElement element)
       int soawa = 0;
       if(element.getRsawaamt() > 0)
         if(( element.getRsawaamt() >= element.getRsminamt() ) && ( element.getRsawaamt() <= element.getRsmaxamt() ))
           soawa = element.getRsawaamt() * element.getRsmaxamt() / 2;
         }else{
           IWDMessageManager messageMgr = wdThis.wdGetAPI().getComponent().getMessageManager();
           IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getChild("Zstk_Stock_Noms").getAttribute("Rsawaamt");
           messageMgr.reportContextAttributeMessage(
            wdContext.currentZstk_Stock_NomsElement(),
            attributeInfo,
           IMessageStockNominationsComp.NOT_BETWEEN_MIN_MAX,
            new Object[] { null },
           true); 
       return soawa;

    Valery,
    I do not see the checkbox that says "Mark as question".
    The only thing I see different on the main thread and the responses is the radio button solved on my own.
    I can send you a screen shot of what I see if you wish.
    Regarding the solution you suggested.  It works fine.  The problem now I am getting is that if I click on a blank cell, the messages below the table are displayed multiple times, but still referring to the one cell that is in error.
    Any ideas?
    Thanks,
    mike

  • Is there any way to disable update check for a specific add-on?

    There are a few add-ons I have problems with their latest versions. So i don't want to update them. But everytime there are any updates for other add-ons they also appear and need to be unchecked. Is there any way to disable update just for them permanently?

    Yes, but it is not straightforward. For details see [http://kb.mozillazine.org/Updating_add-ons Updating add-ons - MozillaZine Knowledge Base]

  • Credit check and Credit hold not working for 2 specific clients

    Hello dear Oracle Support,
    I would like to ask for your help in the following subject:
    The Credit deppartment assign a Credit Hold and a Credit Check for 2 specific customers, but for some reason, these check boxes are not getting respected by the system, since the sales department are not getting any message or warning when creating an order. I tryed to look at these 2 check boxes at a table but I am affraid that I cant find the field, I am using the RA_CUSTOMERS table, but perhaps it is not the correct one, so I was wondering if you could give me any advice.
    Thanks

    Hi
    1. IMG -- SD -- Basic funtions -- credit management/risk mgmt -- credit mgmt -- Define credit groups.
    Here confirm that you have
    01 - credit group sales order
    02 - credit group delivery
    03 - credit group for GI
    2.  IMG -- SD -- Basic funtions -- credit management/risk mgmt -- credit mgmt -- Assign sales document type and delivery document type
    Here you have to assign
    01 - to the sales order(Ex OR) types
    02 - to delivery document type (Ex LF) <b>Dlv credit group</b>
    03 - to delivery document type (Ex LF) <b>GI credit group</b>
    <u><b>For delivery document type we have to assign to credit group one for Delivry another for PGI</b></u>
    3. IMG -- SD -- Basic funtions -- credit management/risk mgmt -- credit mgmt -- Define automatic credit control (OVA8)
    Maintain new combination for Your credit control area/risk categry of the customer/03 (GI credt group)
    Example : 1000/001/03
    maintain static/Dynamic credit check for this combination.
    Note : give warning at order level (credit grp 01) and delivery level (credit grp 02)... and give error at PGI level (credit grp 03).....
    So that you can see difference easyly
    4. FD32 - Maintain credit limit and Risk category(001) for your customer
    5. order - delivery - PGI
    Try this
    Hope your problem will be solved
    Let me know if you have any problem
    Reward points if helpfull
    Muthupandiyan

  • [req] how to check whether given oracle table exist or not + C#

    Hi,
    All.
    Actually i m creating a program using C# which connects to the database (oracle) and checks for the given table "OPC_GROUP". if the table doesnt exists then it creates the table else it updates all field with provided values
    code
    cmd.CommandText = "SELECT tname from tab where tname = 'OPC_GROUP'";
    cmd.CommandType = CommandType.Text;
    int length = cmd.ExecuteNonQuery();
    if (cmd.ExecuteNonQuery() >0)
    MessageBox.Show("Table does exist");
    else
    MessageBox.Show("Table doesnt exist");
    But this code return "TABLE DOESNT EXIST" though table is already created
    What i m doing wrong???
    Please help..........
    Thnx in advance

    Try this..
    cmd.CommandText = "SELECT count(*) from tab where tname = 'OPC_GROUP'";
    cmd.CommandType = CommandType.Text;
    string strnum = cmd.ExecuteScalar().ToString();
    if (strnum!="0")
    MessageBox.Show("Table does exist");
    else
    MessageBox.Show("Table doesnt exist");
    Hope it helps,
    Greg

  • How to Disable InfoUpdate(spinf) check for PO creation

    Dear All,
    I got requirement to Disable InfoUpdate(SPINF) check when PO is created(ME21n).
    Long back for this Project our Team did some configuration(SPRO) for Order Type (Standard PO) this InfoUpdate(SPINF) should be checked by default.
    But know they don't want to create a PO with InfoUpdate(SPINF) check for ONE specific Plant(EKPO-WERKS).
    I tried to find User Exit and BAPI, But I not able to find the exact one to Disable InfoUpdate(SPINF) check based on the condition Plant(EKPO-WERKS).
    So, can some one give me solution to Disable InfoUpdate(SPINF) check.
    Thanks in advance.
    Regards,
    Venkat Ram

    Hi Guys,
    Any help? Any exits/BADIs/enhancement spots that I can use?

  • How to set dbms_stats parameters for a single table

    Hi,
    I see that dbms_stats has the following procedure:
    PROCEDURE SET_PARAM
    Argument Name Type In/Out Default?
    PNAME VARCHAR2 IN
    PVAL VARCHAR2 IN
    Is there a way to change the parameters only for a single table?
    I need to set METHOD_OPT=>'FOR ALL COLUMNS SIZE 1' only for a specific table...

    I'm sorry, mate. It looks like setting individual table preferences was introduced in 11g (and doesn't seem to work all that well).
    You can still:
    1. Explicitly specify any of the supported parameters by using DBMS_STATS.GATHER_TABLE_STATS() for the individual table and run it along.
    2. Write a PL/SQL wrapper for let's say DBMS_STATS.GATHER_SCHEMA_STATS/GATHER_DTABASE_STATS that would gather the stats for the whole schema but ignore this particular table. Then gather the stats for the table with the METHOD_OPT parameter of your choice that could be different from the one used for the rest of the schema.
    This could be achieved by locking particular table stats with DBMS_STATS.LOCK_TABLE_STATS, running GATHER_SCHEMA_STATS with force=>FALSE (which is the default). That parameter will make the procedure ignore any tables with locked stats. As the last step of the wrapper you can execute DBMS_STATS.GATHER_TABLE_STATS for the table in question with the desired METHOD_OPT and force=>TRUE.
    It's a little more work, but may solve your problem.
    Max
    Edited by: Max Seleznev on Nov 28, 2012 6:21 PM
    Edited by: Max Seleznev on Nov 28, 2012 6:22 PM

  • RFC-enabled authorization checks for specific tables?

    I am developing an Excel application which calls several BAPIs and RFC-enabled FMs, most notably RFC_READ_TABLE.  While I will provide security at the FM level by checking S_RFC for these FMs, I need to find a way of restricting access for users to specific tables based on certain table fields?  Is there any SAP-delivered FM/BAPI that will let me do this?
    My understanding is that although RFC_READ_TABLE does check S_TABU_DIS, it only checks tables based on their belonging to a particular table class—It is not checking authorization for an individual table. What this means is that users will need to have access to the table class or classes to which the table or tables belong, for any tables that are being read by RFC_READ_TABLE.
    Please correct me if I am wrong in my understanding, or if there is a standard solution for a situation like this.

    Hi john,
    1. What this means is that users will need to have access to the table class or classes to which the table or tables belong, for any tables that are being read by RFC_READ_TABLE.
    U are perfectly right.
    2. The users will have to be given rights
       NOT TABLE WISE,
       But authorisation group wise.
    3. Note : S_TABU_DIS
       The main purpose of this authorisation object
       is for standard tools like sm30 only.
       Its also used in the FM RFC_READ_TABLE .
    regards,
    amit m.

Maybe you are looking for

  • WCF service connection forcibly closed by the remote host for large data

    Hello ,                     WCF service is used to generate excel report , When the stored procedure returns large data around 30,000 records. Service fails to return the data . Below is the mentioned erorr log : System.ServiceModel.CommunicationExce

  • CTI Toolkit Agent Desktop

    We'd like to add the Chat tool/icon on the Agent Desktop. I know it's a checkbox but where in ICM is it located? Any info is appreciated. Thanks!

  • Photoshop Elements 8 Crashed--HELP PLEASE

    How do I fix my photoshop elemnts 8 after I received a message "PSE unexpectedly crashed".  I was simply uploading pics to Shutterfly and it crashed.  I'm getting no support from the Adobe help line!  Thanl you Laurie C

  • Text won't show in Travel Theme

    I have been reading through the forum and have seen similar problems, but not this exact one. I have created a medium book with 20-some pages, and when I click on "buy book", I am told that there is default text that has not yet been edited. When I p

  • Can not start $./emca, how to set the parameters??????

    Hi All, I have Installed Oracle 10g(10.2)(Enterprise Edition) database on HP UX 11.11. when I try to run $ ./emca it asks me below parameters to setup. where to set these parameters???Why its asking me so many parameters??? $ ./emca /oraback/orahome/