How to set identity_insert to on in SQL Server
You are using the right syntax:

SET IDENTITY_INSERT dbo.sometable ON;


However, a schema in SQL Server is not the same as a database.

The default schema for objects is dbo as in my example. You do not need to specify the database name if you are connected to it, but you could like this:

SET IDENTITY_INSERT DbName.dbo.sometable ON;


There seems to be no way to get the current setting as it is session-scoped and not persisted.

If you run this query in your database it returns the fully qualified names for all tables in there:

SELECT 
    QUOTENAME(DB_NAME())+'.'+
    QUOTENAME(OBJECT_SCHEMA_NAME(object_id))+'.'+
    QUOTENAME(OBJECT_NAME(object_id)) AS FullTableName 
FROM sys.tables;


SET IDENTITY_INSERT ON... must be run in the same session as the insert.