Forum Discussion

Robert Tigwell's avatar
Robert Tigwell
Copper Contributor
Apr 13, 2017

Reference to database and/or server name in 'Azure.dbo.XXX' is not supported in this version of SQL

I am getting an error that seemingly indicates that I'm trying to use linked server or cross-database query when I am in no way trying to.

 

I've opened a stackexchange question w/ full details but no one has seen this scenario.

 

Reference to database and/or server name in 'Azure.dbo.XXX' is not supported in this version of SQL Server

 

(where XXX is my table name)

 

See full details on StackExchange but basically I can SELECT, INSERT, and UPDATE to this particular table but cannot DELETE from it.  When I try to run a DELETE statement, I receive the error above.

 

Have tried disabling TRIGGERs, have tried various combinations of schema/database/tablename in the FROM clause.

 

Pulling my hair out here.

  • David from MSDN forum put me on the right track:

     

    1. See what CASCADE DELETE FK constraints there are
    2. Inspect other table(s)
    3. See trigger on table with 3 part name in FROM clause
    4. Correct to 2 part name
    5. Dance

    To see if there are FK relationships w/ DELETE CASCADE:

    select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS where DELETE_RULE ='CASCADE'

     

  • Robert Tigwell's avatar
    Robert Tigwell
    Copper Contributor

    David from MSDN forum put me on the right track:

     

    1. See what CASCADE DELETE FK constraints there are
    2. Inspect other table(s)
    3. See trigger on table with 3 part name in FROM clause
    4. Correct to 2 part name
    5. Dance

    To see if there are FK relationships w/ DELETE CASCADE:

    select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS where DELETE_RULE ='CASCADE'

     

    • Lana O'Brien's avatar
      Lana O'Brien
      Former Employee

      Hi Robert, thank you for posting the solution! I'm sure other users will have the same question. 

      • Deleted's avatar
        Deleted

        Msg 40515, Level 15, State 1, Line 16
        Reference to database and/or server name in 'Source.dbo.kiran' is not supported in this version of SQL Server.

         

        Please solve it 

         

    • Deleted's avatar
      Deleted
      it's not working
      • ToniPohl's avatar
        ToniPohl
        MVP

        Hi all,

         

        I (still) have the same issue when using BCP.EXE. Locally, it works:

        bcp "select * from myDB.dbo.myTable" queryout mytable.csv -S ServerName -c -T

         

        When executing the same against SQL Azure, the following error results:

        Error = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Reference to database and/or server name in 'myDB.dbo.myTable' is not supported in this version of SQL Server.

         

        Hope, this will be possible in near future...? Thx.

         

Resources