Executing A Sp Via ADO Which Makes A Reference To Linked Server Table Results In Error
Oct 17, 1999
Greetings,
Facing a strange problem, but obviously not expected earlier on, I am trying to execute a stored procedure via ADO which refrences a linked server table and I get an error specifying
"
OLEDB provider SQLOLEDB does not contain table "<DatabaseName>"."<owner>"."<tableName>"
"
Has any one else encountered this problem before ?
regards
Govind
Is it possible to reference a temporary global tale (##table) of a linked server using the 4 parts "identifier": linkedserver.database.schema_name.##object_name ?? Thanks in advance for your help.
Hi all,I am facing an unusual issue here. I have a stored procedure, that return different set of result when I execute it from .NET component compare to when I execute it from SQL Management Studio. But as soon as I recompile the stored procedure, both will return the same results.This started to really annoying me, any thoughts or solution? Thanks very much guys
Is there a way to execute a user-defined function as part of a select query on a linked server?
Here is the query that won't work because the function it calls is on a remote server (and the way I have called it is also incorrect I know, it's just to give an idea of what I'm trying to achieve).
SELECT a.[Member Number],
a.SchemeID,
b.Scheme,
Atlantis.ptr.dbo.upFUNMemberStatusOnADate(a.[Member Number],'01/10/2007 00:00:00.000') AS Category,
a.[Employer Number],
c.[Employer Name] FROM Atlantis.ptr.dbo.Member a
JOIN Atlantis.ptr.dbo.Scheme b
ON a.SchemeID = b.SchemeID
JOIN Atlantis.ptr.dbo.Employer c
ON a.[Employer Number] = c.[Employer Number]
Apologies for the formatting of the query. I have looked at the EXECUTE query in BOL but it doesn't seem to be able to work as part of a SELECT, I'll keep looking though but I'm hoping someone might know the answer straight away.
What is the syntax for creating a update trigger and passing the values which were updated to a stored procedure on a linked server?? Specifically need syntax for updated value, as well as the syntax for executing the stored proc on the linked server.
We have 2 instances. One is sqlgpscluster and another is [sqlcdsclustersqlcds]. We have created linked server between sqlgpscluster and [sqlcdsclustersqlcds]. We run the below query on sqlgpscluster instance
UPDATE [sqlcdsclustersqlcds].CDSBusiness.dbo.tblInsertNowAppMonitoring SET NoCabsDateTime = GETDATE(),City=@City ,Area = dbo.fn_FindAreaSubAreaBasedOnLatLong(@PickUpLat,@PickUpLng) WHERE CustomerMobileNo=@CustomerMobileNo
We are seeing the below error: The OLE DB provider "SQLNCLI" for linked server "sqlcdsclustersqlcds" could not UPDATE table "[sqlcdsclustersqlcds].[CDSBusiness].[dbo][tblInsertNow AppMonitoring]". The rowset was using optimistic concurrency and the value of a column has been changed after the containing row was last fetched or resynchronized.
I get this error when trying to alter a stored procedure that has an insert statement referencing a new linked server I created:
INSERT INTO [servername].databasename.dbo.DirectReport ...
Msg 18456, Level 14, State 1, Procedure Get_Direct_Pay_Move_Data, Line 17 Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.
I added Administrators and my logon to the permissions of my linked server but still get this error when it tries to save my stored proc...the one which has that insert.
I have a linked server named 'Charlie_File' to an Excel Workbook that I set up in SQLServer 2005 Management Studio. The workbook is on my local C drive. Sometimes, I get the results back that I expect when I run the following query;
SELECT * FROM OPENQUERY(Charlie_file, 'SELECT * FROM [Feb$]')
Sometimes, on subsequent runs of the above query, I get the following message;
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "MSDASQL" for linked server "Charlie_file" reported an error. The provider did not give any information about the error. Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "Charlie_file".
There seems to be about a minute or so of a delay before the query will run correctly on subsequent attempts. Is there a connection issue here where a connection blocks subsequent attempts to select the data within a specific time span?
I have a table which visibility can be toggled by a text box. By default it is invisible. After it is made visible, clicking a sortable column header makes the table invisible. Does this mean sorting makes the table go back to its default visibility?
I've been programming with SQL 7 for about a year and my company has finally decided to go SQL 2k5.
I've come accross a really irritating error when writing to the DB via ADO in ASP pages. I have a column in a table that is auto-incremental.
In SQL server 7 you just make an ADODB.Command object and enter the SQL query 'insert into table (columns) values ('val...') now for SQL 7 I can completely leave out the auto-incremental column (called 'ErrorNo') and simply specify the other columns and values in my insert query. e.g. where my table is called master_error:
ErrorNo int identity (1, 1) not null ,ReportedBy char(10) ,ExpectedFixDate datetime
With ErrorNo being an auto-incremental identity, my query would be
INSERT INTO master_error (ReportedBy, ExpectedFixDate) VALUES ('Ben','01 Sep 2007')
this works perfectly with ADODB.Command when writing to SQL Server 7 from IIS 5.0
however when I execute the exact same command on the exact same table using ADODB.Command writing to SQL Server 2005 from IIS 6.0 I get an 'error 500 internal server error'
I thought perhaps SQL 2005 might have different syntax so I typed the query directly into SQL Server 2005's version of query analyser and guess what... it worked fine.
I can't tell where the error lies. I find it hard to beleive that the error is in the code of my ASP page as it works perfectly against a sql 7 db.
Hi, have configured an ODBC linked server for an Adaptive Server Anywhere (ASA6.0) database. I have to write a function (not a procedure) that receives a number (@Code) and returns 1 if it was found on a table in the linked server, or 0 if not. Looks very simple... One problem, is that the queries on a linked-server must be made through the OPENQUERY statement, which doesen't support dynamic parameters. I've solved this making the whole query a string, and executing it, something like this:
SET @SQL='SELECT * FROM OPENQUERY(CAT_ASA, ''SELECT code FROM countries WHERE code=' + @Code + ''')' EXEC sp_executesql @SQL
(CAT_ASA is the linked-server's name)
Then, i would use @@ROWCOUNT to determine if the code exists or not. But before this, a problem appears: sp_executesql is not allowed within a function (only extended procedures are allowed). Does somebody know how to make what i want?? I prefer to avoid using temporary tables. Thanks!
Until today, I was always under the impression that left vs. right was determined by which side of the comparison operator the table was located.
In other words: LEFT JOIN LeftTable.ID = RightTable.ID
would pull all the records from LeftTable and those that matched from from RightTable and that:
RIGHT JOIN RightTable.ID = LeftTable.ID
would pull exactly the same result set but I was wrong. So, if it is not the table position in relation to the comparison operator, is it simply that the tables listed first in the FROM clause aren the ones "Left" of those subsequently entered?
We are just upgrading a server from 2000 to 2005 and we are getting the message below when we execute a sql statement against a table with a date field with null values:
"Error converting data type DBTYPE_DBTIMESTAMP to datetime."
Hello All & Thanks in advance for your help!Background:1) tblT_Documents is the primary parent transaction table that has 10fields and about 250,000 rows2) There are 9 child tables with each having 3 fields each, their ownPK; the FK back to the parent table; and the unique data for thattable. There is a one to many relation between the parent and each ofthe 9 child rows. Each child table has between 100,000 and 300,000rows.3) There are indexes on every field of the child tables (though Idon't believe that they are helping in this situation)4) The client needs to be presented a view that has 5 of the mainfields from the parent table, along with any and all correspondingdata from the child tables.5) The client will select this view by doing some pattern-matchingsearch on one of the child records' detail (e.g. field-name LIKE%search-item% - so much for the indexes...)Problem:When I do the simple join of just the parent with one of the children,the search works *fairly* well and returns the five parent fields andthe corresponding matching child field.However, as soon as I add any one of the other child records to simplydisplay it's unique data along with the previously obtained results,the resulting query hangs.Is the overall structure of the tables not conducive to this kind ofquery? Is this a situation where de-normalization will be required toobtain the desired results? Or, more hopefully, am I just an idiotand there is some simpler solution to this problem?!Thanks again for your assistance!- Ed
I keep running into a problem with the debugger freezing up. I'm trying to pull results from a query into an array (not more than 10 rows)
cmd.ExecuteReader();
while (rdr.Read() == true) {
letter = rdr[0].ToString();
i += 1;
}
if I comment out the "letter = rdr[0].ToString();" portion of code, the project runs fine. With that code there, I can not step into the proc from the SQL test script. No errors are raised. VS just freezes.
Hi, this is my first post and I'm relatively new to SSIS so please go easy on me.
Without going into too much detail about it, I've set up a simple SSIS package which does this in a nutshell:
Foreach loop picks up all *.xls files in a given folder 1 - Puts the name of the current spreadsheet into a variable 2 - File System Task copies the current spreadsheet ("abc.xls") to a file called "work.xls" 3 - Data Flow task performs data extraction on "work.xls" and puts it into a SQL server database 4 - File System Task moves "abc.xls" into a "success" folder Continues with loop - move onto next spreadsheet
This works fine, so long as the spreadsheets all have the same number of columns.
As soon as one of them has a column missing (believe me, this will happen - we're dealing with users here) the package falls over at step 3.
When the package comes across an erroneous spreadsheet, what I'd like to do is move the offending file to a failure folder (making step 4 either a success or failure file move) and carry on with the next one.
I know that you can have an error path (the red line) from any step within the dataflow task, but this doesn't help me because the error lies in the structure of the spreadsheet and not the contents.
I've already come up with a work around whereby each file is moved into the failures folder just after step 2, then moved from the failures folder into the success folder at step 4.
This almost gives me what I want, although of course the package still falls over whenever it encounters a dodgy looking spreadsheet.
Is there any way that I can get the package to do what I'm after?
You know how osql can return the results of executing a .sql script to a window? Is there any way to achieve that same behavior in .NET? I am in the process of working on an application that needs to execute a .SQL script (which is easy to do) and then return the actual SQL output from the execution to a window. How do I get that output? None of the sql data objects seem to support this.
Hi,I wanted to know if this is possible and if so, how do Ido it. Say, I have a query "SELECT * FROM Table WHEREColumn="some_value". This executes on a very large dataset and I would like to return the results as they queryexecutes rather than wait for the whole query to execute.Basically, I want to get the results as they are preparedby the database. Any way to do this?Regards,San
I am using web developer 2008, while connecting to I wanted to fetch data from Lotus notes database file, for this i used notesql connector, while connectiong to notes database i am fetting error
ERROR [42000] [Lotus][ODBC Lotus Notes]Table reference has to be a table name or an outer join escape clause in a FROM clause
I have already checked that database & table name are correct, please help me out How i can fetch the lotus notes data in my asp.net pages.
I am using web developer 2008, while connecting to I wanted to fetch data from Lotus notes database file, for this i used notesql connector, while connectiong to notes database i am fetting error
ERROR [42000] [Lotus][ODBC Lotus Notes]Table reference has to be a table name or an outer join escape clause in a FROM clause
I have already checked that database & table name are correct, please help me out How i can fetch the lotus notes data in my asp.net pages.
Hi. Does anyone know how to display the results if i execute "xp_fixeddrives, xp_availablemedia and xp_subdirs" commands with VC++ 6.0? I can't obtained the results using Recordset class. Can someone help me? Thank you.
Folks, I have an issue in producing output for the following query in MDX Query builder avaialable in BIDS. the error message I get is: The query cannot be prepared: The query must have at least one axis. The first axis of the query should not have multiple hierarchies, nor should it reference any dimension other than the Measures dimension.. Parameter name: mdx (MDXQueryGenerator)
Code Snippet WITH MEMBER [Measures].[Annualized Vs Target] AS '[Measures].[Revenue]-[Measures].[Target Revenue]' SELECT NON EMPTY { ([Measures].[Balance],[Year].[Year - Year].&[2006]) , ([Measures].[Balance], [Year].[Year - Year].&[2007]), ([Measures].[Revenue], [Year].[Year - Year].&[2006]), ([Measures].[Target Revenue], [Year].[Year - Year].&[2007]), ([Measures].[Revenue], [Year].[Year - Year].&[2007]), ([Measures].[Annualized Vs Target], [Year].[Year - Year].&[2007]) } ON COLUMNS , NON EMPTY { ([Client - Coverage Region].[Region Name].[Region Name].ALLMEMBERS * [Client].[Client Name].[Client Name].ALLMEMBERS)} ON ROWS FROM [MIS POC FINAL]
Do Anybody has a solution for this? I require the output to be in the following format :
Region_Name(RegDim) Client_Name(ClientDim) Balance_2006 Balance_2007 Revenue_2007 TargetRevenue_2007 USA A 20000 30000000 40000000 5000000000
B 60000 70000000 80000000 9000000000
Note: We can execute the above query in SSMS-MDX Query window without any issues.
Many Thanks in Advance for any assistance. Subhash Subramanyam, Suraj Magdum
I am using SQL Server 2005 and trying to create a linked server on Oracle 10. I used the commands below: EXEC sp_addlinkedserver @server = 'test1', @srvproduct = 'Oracle', @provider = 'MSDAORA', @datasrc = 'testsource' exec sp_addlinkedsrvlogin @rmtsrvname = 'test1', @useself = 'false', @rmtuser='sp', @rmtpassword='sp'
When I execute select * from test1...COUNTRY I get the error. "The OLE DB provider "MSDAORA" for linked server "...." does not contain the table "COUNTRY". The table either does not exist or the current user does not have permissions on that table." The 'sp' user I am connecting is the owner of the table. What could be the problem ? Thanks a lot.
I have an Excel/ vba module to update a SQL database. One of the data is numeric. If the data is a positive number, there is no problem, but if the number (zscore) in Excel is negative an error pops up: Error converting datatype varchar to numeric.
I'm trying to set up a linked table from SQL Server 2005 to MS Access. The .mdb file resides on a network share and I'm unable to connect to it. If i copy the database to a folder on the server that SQL is installed, it works fine. Any help would be greatly appreciated. Below is the error message that I'm receiving.
TITLE: Microsoft SQL Server Management Studio ------------------------------
"The linked server has been created but failed a connection test. Do you want to keep the linked server?"
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "LINKSERVER". OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "LINKSERVER" returned message "The Microsoft Jet database engine cannot open the file '\serversharedatabase.mdb'. It is already opened exclusively by another user, or you need permission to view its data.". (Microsoft SQL Server, Error: 7303)
I have access97 front end , with linked tables to sql server 2005. when i change a table ID column (type int) to primary key so it is updatable, then try open the table i get odbc error with no msg, if i alter table again to remove primary key option table opens fine but is not updateable. any ideas would be a great help
I'm just starting out with SSIS and I'm currently looking to migrate some non-SSIS ETL processes to SSIS. Some of these processes are run manually depending on the results from a previous step. In these processes a user remotely executes an individual ETL program and is shown reports detailing the result of the program and various statistics about the data involved.
Is it possible to replicate this behaviour with SSIS / SSRS, or would the user have to execute a package and then manually find and bring up each of the relevant reports?
I'm new to SSIS and I'm still struggling to find out SSIS's capabilities, so I'd be really grateful if anyone could shed some light on this...
.... DTSRun: Executing... DTSRun OnStart:DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart:DTSStep_DTSExecuteSQLTask_2 DTSRun OnStart:DTSStep_DTSExecuteSQLTask_4 DTSRun OnStart:DTSStep_DTSDataPumpTask_2 DTSRun OnError:DTSStep_DTSDataPumpTask_2, Error = -2147467259 (80004005) Errorstring: [Microsoft][ODBC Visual FoxPro Driver]Cannot open filee:private.dbc. Error source: Microsoft OLE DB Provider for ODBCDrivers Help file: Help context: 0 Error DetailRecords: Error: -2147467259 (80004005); Provider Error: 171(AB) Error string: [Microsoft][ODBC Visual FoxPro Driver]Cannotopen file e:private.dbc. Error source: Microsoft OLE DBProvider for ODBC Drivers Help file: Help context: 0DTSRun OnFinish: DTSStep_DTSDataPumpTask_2 DTSRun OnStart:DTSStep_DTSExecuteSQLTask_6 DTSRun OnFinish:DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart:DTSStep_DTSDataPumpTask_3 DTSRun OnError: DTS... Process Exit Code4. The step failed.anyone know becaouse if i execute this job whit the Schedule packagedont work but i execute manually it's work ?pls help me ...
Hi.I have the problem that some records in a ms sqlserver table is unableto update from Access.I get the error message odbc-time out error in linked table......I tried to copy this table to another database, where none but me wasaktive.And then it worked quit ok when I try to save the record.I am thinking about if there is some trigger och restraint that Idon't know about, but I don't know how to se all of this in thedatabase.I have changed the odbc-timeout settings in Access but that doesn'tseed to make any differenceSo what's the problem?Does anyone have an idea?/regards BigOlle
I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query window
Please see the image through this url http://kyxao.net/127/ExecutionProblem.png
I am working on an application used to move packages (SSIS Packages) from one server to another.The packages are saved under MSDB folder.
Case: When the application is running on my system, i try to copy packages created from another server to my Server.I am using package protection level as "Server Storage". When i try to execute the coppied package from my system, it is giving me error. An oledb error has occured, Error Code 0x80040E4D, An Oledb record is available, Source : Microsoft OLedb Provider for Sql Server", Description : "Login failed for sa".
Case : When the Package Coppier application is running on my system, i try to copy packages created on my server to my another Server.I use the same package protection level as "Server Storage". When i try to execute the copied package on destination server it is working fine without errors.
Please guide me on this issue, as soon as possible