SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-61971%22%20slang%3D%22en-US%22%3EReference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%20SQL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-61971%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20getting%20an%20error%20that%20seemingly%20indicates%20that%20I'm%20trying%20to%20use%20linked%20server%20or%20cross-database%20query%20when%20I%20am%20in%20no%20way%20trying%20to.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20opened%20a%20stackexchange%20question%20w%2F%20full%20details%20but%20no%20one%20has%20seen%20this%20scenario.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EReference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%20SQL%20Server%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E(where%20XXX%20is%20my%20table%20name)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESee%20full%20details%20on%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdba.stackexchange.com%2Fquestions%2F170828%2Fdelete-records-from-single-azure-db-table-that-has-no-linking-reference-to-dat%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EStackExchange%3C%2FA%3E%26nbsp%3Bbut%20basically%20I%20can%20SELECT%2C%20INSERT%2C%20and%20UPDATE%20to%20this%20particular%20table%20but%20cannot%20DELETE%20from%20it.%20%26nbsp%3BWhen%20I%20try%20to%20run%20a%20DELETE%20statement%2C%20I%20receive%20the%20error%20above.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EHave%20tried%20disabling%20TRIGGERs%2C%20have%20tried%20various%20combinations%20of%20schema%2Fdatabase%2Ftablename%20in%20the%20FROM%20clause.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EPulling%20my%20hair%20out%20here.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-61971%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EData%20%26amp%3B%20Storage%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EStorage%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-191531%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-191531%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tony%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20ran%20into%20the%20same%20issue%20using%20the%20bcp%20utility.%26nbsp%3B%20I%20discovered%20there%20is%20another%20flag%20which%20may%20be%20used%20to%20specify%20the%20database%3A%20-d%20MyDatabaseName.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-135064%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-135064%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20(still)%20have%20the%20same%20issue%20when%20using%20BCP.EXE.%20Locally%2C%20it%20works%3A%3C%2FP%3E%0A%3CPRE%3Ebcp%20%22select%20*%20from%20myDB.dbo.myTable%22%20queryout%20mytable.csv%20-S%20ServerName%20-c%20-T%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20executing%20the%20same%20against%20SQL%20Azure%2C%20the%20following%20error%20results%3A%3C%2FP%3E%0A%3CP%3EError%20%3D%20%5BMicrosoft%5D%5BODBC%20Driver%2013%20for%20SQL%20Server%5D%5BSQL%20Server%5DReference%20to%20database%20and%2For%20server%20name%20in%20'%3CSPAN%3EmyDB.dbo.myTable%3C%2FSPAN%3E'%20is%20not%20supported%20in%20this%20version%20of%20SQL%20Server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHope%2C%20this%26nbsp%3Bwill%20be%20possible%20in%20near%20future...%3F%20Thx.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-78787%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-78787%22%20slang%3D%22en-US%22%3Eit's%20not%20working%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-78785%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-78785%22%20slang%3D%22en-US%22%3Eabove%20ans%20not%20working%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-78784%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-78784%22%20slang%3D%22en-US%22%3E%3CP%3EMsg%2040515%2C%20Level%2015%2C%20State%201%2C%20Line%2016%3CBR%20%2F%3EReference%20to%20database%20and%2For%20server%20name%20in%20'Source.dbo.kiran'%20is%20not%20supported%20in%20this%20version%20of%20SQL%20Server.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20solve%20it%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-62449%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-62449%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Robert%2C%20thank%20you%20for%20posting%20the%20solution!%20I'm%20sure%20other%20users%20will%20have%20the%20same%20question.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-62409%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-62409%22%20slang%3D%22en-US%22%3E%3CP%3EDavid%20from%20MSDN%20forum%20put%20me%20on%20the%20right%20track%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3ESee%20what%20CASCADE%20DELETE%20FK%20constraints%20there%20are%3C%2FLI%3E%3CLI%3EInspect%20other%20table(s)%3C%2FLI%3E%3CLI%3ESee%20trigger%20on%20table%20with%203%20part%20name%20in%20FROM%20clause%3C%2FLI%3E%3CLI%3ECorrect%20to%202%20part%20name%3C%2FLI%3E%3CLI%3EDance%3C%2FLI%3E%3C%2FOL%3E%3CP%3ETo%20see%20if%20there%20are%20FK%20relationships%20w%2F%20DELETE%20CASCADE%3A%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22kwd%22%3Eselect%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22pun%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kwd%22%3Efrom%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20INFORMATION_SCHEMA%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3EREFERENTIAL_CONSTRAINTS%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22kwd%22%3Ewhere%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3E%20DELETE_RULE%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22str%22%3E'CASCADE'%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1094552%22%20slang%3D%22en-US%22%3ERe%3A%20Reference%20to%20database%20and%2For%20server%20name%20in%20'Azure.dbo.XXX'%20is%20not%20supported%20in%20this%20version%20of%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1094552%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144974%22%20target%3D%22_blank%22%3E%40Theodore%20Sill%3C%2FA%3E%2C%20It%20solved%20my%20problem!!!%3C%2FLINGO-BODY%3E
New Contributor

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.

8 Replies
best response confirmed by Robert Tigwell (New Contributor)
Solution

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'

 

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

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 

 

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.

 

Hi Tony,

 

I ran into the same issue using the bcp utility.  I discovered there is another flag which may be used to specify the database: -d MyDatabaseName.