• Pulivarthi Sasidhar (11/27/2014)


    The query executing successfully in Query window?

    If yes... then Security permission issues are there ..

    The problem with the SQL Agent is that it runs under an account which does not have the same privileges than the user using the SQL Server Management Studio (usually a Windows Administrator or a user with higher privileges).

    You can change the User account of the SQL Server Using the SQL Server Configuration Manager and you can use proxies to run jobs with more privileges.

    You can use this link to learn more abouth SQL Server Proxies

    Below is link where i got info...

    https://social.msdn.microsoft.com/Forums/en-US/240943f0-7b3a-43ab-82d6-4a2e02254e15/failed-to-initialize-sqlcmd-library-with-error-number-2147467259?forum=sqlgetstarted

    Thanks,

    SP

    Thanks.

    Query is fine and service account is my own id with administrator rights.

    When I run the script manually also it doesn't work.

    If I comment "@query=", then everything is working fine.