SQL Server 2008 R2 Linked Server to another SQL Server 200r R2 select query error Invalid data for type "Numeric" - sql

we are having the following error message on a SQL Server 2008 R2 with SP1 linked server to another SQL Server 2008 R2 with SP2. The error message is: Invalid data for type "numeric" and is happening intermittently. It worked for couple months and re-appearing again. Called Microsoft Support last July 2012, they haven't able to solve it either and we closed the case after it mysteriously disappeared. All we did is just applied some Windows OS patches before the problem disappeared. Now the problem is re-appearing. The error message was from a simple query
select *
from Sales_LinkedServer].sales.dbo.temp_sales_detail
However, this table contains over 2 millions records. Tried and still failed using the
OPENQUERY:
Select *
From OPENQUERY ([Sales_LinkedServer],
'Select *
From Sales.dbo.temp_sales_detamil');
Also, this is happening on our production server but the similar Dev server has no problem at all.

Related

SQL Query not working properly after migrating to Sql Express from sql server 2008

I was working on a database in sql server 2008 and all my queries were working but now we have shifted the database to sql express 2012.
Now some of my queries are working whereas some are throwing error
Example:
SELECT DATEPART(HOUR,TIME_OF_DAY) FROM dbname.T1
Query1 error: Cannot convert string to datetime.
Now if I select * from dbname.T1 and replace the * with DATEPART(HOUR,TIME_OF_DAY) it is working.
The only difference is Initially it is using SQLEXPRESS.dbname and when it runs it is using SQLEXPRESS.master
I don't understand why this is happening. Thanks in advance

SQL Replication Publisher thinks Subscriber is wrong version

I have two SQL Server 2008 instances, one running Workgroup Edition (publisher) and the other Standard (subscriber)
I am trying to replicate a database but I am getting errors when it tries to create the database at the subscriber because it thinks it is running SQL Server 2005 for some reason.
Has anyone had this issue before?
I am getting this error
Column Location in object Members contains type Geography, which
is not supported in the target server version, SQL Server 2005.
Have you checked compatibility mode for the databases?
For example:
SELECT compatibility_level
FROM sys.databases WHERE name = 'YourDBName';

Master table node missing , SQL Server 2012 SP1

I've installed Microsoft SQL Server 2012 Express with SP1 (with all the "Cumulative Update #6 for SQL Server 2012 SP1")
Can't view any "table node" on System database under “master” in the Management Studio.
Note : there is a post here that point to another link (MS id : 773184), but is confusing.
Appears is a bug "solved" but still the same problem...
Please advice
Master Table Node missing
http://connect.microsoft.com/SQLServer/feedback/details/773184/ssms-system-databases-node-does-not-show-tables
SP1 CU#7 is out. Try to update and check.
http://support.microsoft.com/kb/2894115

Can I create a view that will query a table from another sql server on another server but same domain

I need to query a table from another SQL Server on a different server but same domain, but I am not sure how I will be able to do it.
I tried solution given in this answer Can I create view in my database server from another database server but it doesn't work for me as I got SQL Server 2000 (please don't hate :-) ).
When I try solution given then i get this error,
Line 23: Incorrect syntax near '-'.
which is because command is not compatible with SQL Server 2000.
Edit
SELECT * FROM AnotherServer.AnotherServerDatabase.Server.Table1
you can link the servers and run cross server queries as long as you put the server name before the DB your running the query on.
For example
SELECT * FROM "linkedserver".dbo.aTable
(without "" marks )
bear in mind different server versions though. I run cross server queries from 2008 to 2000 servers and its a pain adapting :)

Strange issue between sql server 2005 (32x) and sql server 2008 (64x) linked server

I have successfully created linked server between 2005 and 2008 version. We changed a table schema on 2008 and re ordered the table columns. We also did the same on 2005 server.
If we query both table in their own database then schema looks fine however
when I do
SELECT * FROM and Select * from then it is showing me old schema for 2008 table. Due to this my join and inserts are failing. Error "insert failed due to table column mismatch"
We restarted both the machines still not luck
Any idea ?
After some research I found answer on stack overflow it self :D
Column name or number of supplied values does not match table definition
Do drop #table and then select * INTO