Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Getting error while insert rows using linkedserver

Author  Topic 

hafeez
Starting Member

14 Posts

Posted - 2007-08-29 : 08:00:52
Hello All,
I created two database instances in the same MS SQL SERVER 2005 named hafeez and local. I created a linked server from hafeez database to local named HTOL

I created a dummy table in local database named samplocal.

Now i am able to list the records using the linked server, for this i used the following query.

SELECT * FROM OPENQUERY(HTOL,'SELECT nameandval FROM SAMPLOCAL');

Now the problem is, i am not able to insert the rows into the samplocal table using linkedserver. I am using the following query to insert the rows and getting the following errro.

INSERT INTO OPENQUERY(HTOL,'SELECT nameandval FROM SAMPLOCAL') VALUES('tertertetttwertw');

Msg 7356, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI" for linked server "HTOL" supplied inconsistent metadata for a column. The column "nameandval" (compile-time ordinal 1) of object "SELECT nameandval FROM SAMPLOCAL" was reported to have a "Incomplete schema-error logic." of 0 at compile time and 0 at run time.

Is the above query correct? or shall i miss anything?

Please guide me.

Thanks in Advance
Hafeez Shaik.


rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-30 : 01:09:37
Specify db name and schema in openquery, or try with four-part name instead.
Go to Top of Page

hafeez
Starting Member

14 Posts

Posted - 2007-08-30 : 02:57:13
Hello rmiao,
Can u plz give me the sample query?

Thanks and Regards,
Hafeez Shaik
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-30 : 21:52:32
INSERT INTO OPENQUERY(HTOL,'SELECT nameandval FROM local.schema.SAMPLOCAL') VALUES('tertertetttwertw');

Replace schema with real schema name.
Go to Top of Page
   

- Advertisement -