Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'dbo.auditrec'

  • 1> 2> 1> 2> 3> 1> 2> 3> 4> 5> 6> 1> 2> output

    ------------------------------------------------------------------------------

    -----------------------------------------------------------------------

    -----------------------------------------------------------------------

    -----------------------------------

    NULL

    (1 row affected)

    1> 2> output

    ------------------------------------------------------------------------------

    -----------------------------------------------------------------------

    -----------------------------------------------------------------------

    -----------------------------------

    SQLState = S0002, NativeError = 208

    Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'dbo.auditrec'.

    SQLState = 37000, NativeError = 8180

    Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.

    NULL

    (5 rows affected)

    1>

    I get error message after run this sql across network as sql script below.

    use DM_testDMS03_docbase

    go

    IF OBJECT_ID ('auditrec', 'view') IS NOT NULL DROP VIEW auditrec

    go

    create view auditrec as

    select u.test_pol_no,u.test_box_id,u.object_name,u.event_name,u.user_name,u.event_description,

    u.time_stamp from

    (select dbo.test_supertype_sp.test_pol_no, dbo.test_supertype_sp.test_box_id, dbo.test_supertype_sp.object_name,

    dbo.dm_audittrail_sp.event_name, dbo.dm_audittrail_sp.user_name, dbo.dm_audittrail_sp.event_description, dbo.dm_audittrail_sp.time_stamp

    FROM dbo.dm_audittrail_sp INNER JOIN dbo.test_supertype_sp ON dbo.dm_audittrail_sp.chronicle_id = dbo.test_supertype_sp.r_object_id)u

    go

    exec master..xp_cmdshell 'IF EXIST D:\AuditExport\Report\policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt DEL D:\AuditExport\Report\policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt'

    go

    exec master..xp_cmdshell 'bcp "select * from dbo.auditrec order by test_pol_no desc" queryout "D:\AuditExport\Report\temp_policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt" -c -T -t ";"'

    go

    Please advice me!

  • This was removed by the editor as SPAM

  • Thanks for your reply.

    I debug step by step and then i found as below.

    1. use DM_SCNYLDMS03_docbase ==> pass

    2. IF OBJECT_ID ('auditrec', 'view') IS NOT NULL DROP VIEW auditrec ==> pass

    3. create view dbo.auditrec as

    select u.scnyl_pol_no,u.scnyl_box_id,u.object_name,u.event_name,u.user_name,

    u.event_description,u.time_stamp from

    (select dbo.scnyl_supertype_sp.scnyl_pol_no, dbo.scnyl_supertype_sp.scnyl_box_id, dbo.scnyl_supertype_sp.object_name,

    dbo.dm_audittrail_sp.event_name, dbo.dm_audittrail_sp.user_name, dbo.dm_audittrail_sp.event_description, dbo.dm_audittrail_sp.time_stamp

    FROM dbo.dm_audittrail_sp INNER JOIN dbo.scnyl_supertype_sp ON

    dbo.dm_audittrail_sp.chronicle_id = dbo.scnyl_supertype_sp.r_object_id)u

    ==> pass

    4. exec master..xp_cmdshell 'IF EXIST D:\AuditExport\Report\policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt DEL D:\AuditExport\Report\policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt'

    ==> pass

    5. exec master..xp_cmdshell 'bcp "select * from dbo.auditrec order by scnyl_pol_no desc" queryout "D:\AuditExport\Report\temp_policies_log-%date:~10%%date:~4,2%%date:~7,2%.txt" -U scnyl\Administrator -P Passwords1 -S DISERVE-DB-01 -c -T -t ";"'

    ==> found the error

    Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name 'dbo.auditrec'.

    SQLState = 37000, NativeError = 8180

    Error = [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.

    I already config at DISERVE-DB-01 (it's database server and the same instance name) as

    1. open DB Engine remote connections to be "using TCP/IP and name pipes"

    How can i do anymore????? Many thanks!!!

  • This was removed by the editor as SPAM

  • Can you give me an example code as follow as my code!!! Thanks.

  • This was removed by the editor as SPAM

  • Error :

    [SQL Native Client]Named Pipes Provider: Could not open a connection

    to SQL Server [2].

    [SQL Native Client]Login timeout expired

    [SQL Native Client]An error has occurred while establishing a

    connection to the server. When connecting to SQL Server 2005, this

    failure may be caused by the fact that under the default settings SQL

    Server does not allow remote connections.

    1. Already opened DBEngine Remote Service with "Using both TCP/IP and named pipes"

    2. Add in "C:\windows\system32\drivers\etc\hosts" of the other server (it use to connect to DISERVE-DB-01.) as below

    192.168.1.21 DISERVE-DB-01

    How can i do next????? Many thanks for your advice.

  • This was removed by the editor as SPAM

  • Many thanks for your advice. It's perfect solution.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply