Environment
- Azure SQL database (migrated from SQL Server)
- Old database originally (15 years+)
- Dealing with a single table (trying to delete records)
- Using an admin user
- Using SSMS 2014
- There are some triggers on the table (disabling them yields no change in error)
- Name of database is
databasename
in our example here - There is an azure blob storage where files are stored and are "referenced" by an app via the records in said
tblImages
table — but I cannot see any hard link between the two (is that even possible?)
I can select, insert and update records in this table, but cannot delete.
Failing Script
delete from
[databasename].[dbo].[tblImages]
where companyid = 123
Error:
Msg 40515, Level 15, State 1, Line 91 Reference to database and/or
server name in 'Azure.dbo.tblImages' is not supported in this version
of SQL Server.
But who said anything about "Azure.dbo.tblImages' ?!?
Things I've tried
- Have tried fully qualifying the table name, and not – no change.
- Have tried deleting records using the "edit top 200" feature, same error
- tried disabling all triggers on the table, no change
- tried script "create to new window" but nothing about linked databases/servers or other table constraints
Here's a simple test that succeeds with entirely same environment:
CREATE TABLE _tmpPersons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
INSERT INTO _tmpPersons ( PersonID , LastName , FirstName , Address , City )
VALUES (123, 'Tore', 'Tess', '123 Main St.', 'Nowheresville');
select * from _tmpPersons;
delete from _tmpPersons where PersonId = 123;
select * from _tmpPersons;
I have already tried fully qualified [database].[schema].[table]
and different combinations thereof.
It is definitely a table, and there ARE triggers, but disabling them changes nothing.
Zero results found from:
SELECT OBJECT_NAME(referencing_id), referenced_database_name
FROM sys.sql_expression_dependencies
WHERE referenced_database_name IS NOT NULL;
Best Answer
Change your query from
to