Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2014
    Posts
    3

    Unanswered: sqlserver and powershell

    I need help.
    How I get this to run using powershell

    PS D:\restore> "select count(*) from [group]" |sqlcmd

    Msg 208, Level 16, State 1, Server xxxxxx, Line 1

    Invalid object name 'group'.

    Could some one please help.

    Kind Regards.
    Ivan


    Found the answer,
    "set quoted_identifier on; select count(*) from `"group`"" | sqlcmd ....database etc.
    Last edited by Ivancevallos; 09-26-14 at 02:22. Reason: add

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    You can also use the traditional syntax of SQLCMD:
    Code:
    $server=server
    sqlcmd /S $server /E /Q "select count(*) from [group]"
    Last edited by MCrowley; 09-26-14 at 10:09. Reason: Fixed a typo

  3. #3
    Join Date
    Apr 2004
    Location
    Arizona
    Posts
    75

    Group By

    What is [Group]? Do you actually have a table named "Group"? Also we don't have your DDL for the table Group so I don't know what columns you have.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •