I had (have!) trouble deleting replicate Articles with SQLserver 2012 (11.0.3000.0) after a server rename.
That in turn does not allow me some table operations, notably truncate.
You could use dynamic sql to check the existence of databases in linked servers when using parameters.
DECLARE @SourceHost nvarchar(50) = '[CGENMONOSAMP02]';
DECLARE @SourceDB nvarchar(50) = 'Sample_DB';
--@SourceHost is CGENMONOSAMP02
--@SourceDB is Sample_DB
CREATE TABLE #temp ([name] nvarchar(50));
IF NOT EXISTS (SELECT [name] FROM master....
You could use OPENQUERY() to be able to query the linked server and apply FORCESEEK / FORCESCAN hints.
SELECT * FROM
'SELECT DISTINCT Table3.Field5
FROM Server1.Database1.Table1 AS T1
INNER JOIN Server1.Database1.Table2 AS T2 WITH (FORCESEEK) -- Index exists for T2.Field2
ON T1.Field1 = T2.Field2
INNER JOIN Server1....
You CANNOT use FROCESCAN or FORCESEEK on remote data sources.
Reference: Hints (Transact-SQL) - Table
The FORCESCAN hint has the following restrictions:
The hint cannot be specified for a remote data source.
When using the FORCESEEK hint (with or without index parameters), consider the following guidelines:
The hint cannot be specified for a remote ...
The solution was to change the NLS_LANG value in the registry to "AMERICAN_AMERICA.US7ASCII" because of reasons described in these answers:
If we have US7ASCII characterset why does it let us store non-ascii characters?
difference between NLS_NCHAR_CHARACTERSET and NLS_CHARACTERSET for Oracle
Now the characters are coming through correctly.
The NLS parameters you posted are for Oracle client connections. Since you are not actually using an Oracle client, I doubt they will be relevant. (They look like default values.) To confirm the database character set, run:
select value from NLS_DATABASE_PARAMETERS where parameter='NLS_CHARACTERSET'
If it is a recent version of Oracle, I'd expect it ...