SQL Linked Server Update Openquery syntax error - sql-server-2008-r2

I am trying to update data in a PervasiveSQL backend (Sage ERP system) from SQL Server 2008 R2 via a Linked Server setup. Below are details and error msg returned... The kicker is that the update statement works on a development box just fine, very similar setup. Any help will be GREATLY appreciated!
Environment:
Windows Server 2008 Enterprise (Cloud server, Rackspace)
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86) Express Edition with Advanced Services on Windows NT 6.1 (Build 7601: Service Pack 1) (WOW64) (Hypervisor)
Sage Timberline ERP running with Pervasive SQL v.10 backend
Setup:
We have a LINKED SERVER setup in SQL Server 2008, using a 32-bit Timberline Driver (OBDC)
Linked server is using a MSDASQL provider with the following two properties set to TRUE, “Allow inprocess” and “Non Transacted Updates”
Issue:
We can successfully pull data, see query below, from linked server. We can successfully browse objects via the linked server in SSMS.
SELECT *
FROM OPENQUERY (TLLINKSERVER, 'SELECT * FROM TABLE1 where JOBID = ''00-00-111111''')
However the UPDATE statement below returns the following error.
UPDATE OPENQUERY(TLLINKSERVER, 'SELECT * FROM TABLE1 WHERE JOBID = ''00-00-111111''')
SET DATEFIELD = '2013-07-15'
Error:
OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" returned
message "[Sage Timberline Office][Sage Timberline Office ODBC
Driver]Syntax Error.". OLE DB provider "MSDASQL" for linked server
"TLLINKSERVER" returned message "[Sage Timberline Office][Sage
Timberline Office ODBC Driver]UPDATE "\SERVER1\Company
Data\DATA\COMPANY1\"<< ??? >>."TABLE1" SET "DATEFIELD1"=? WHERE
"JOBID"=? AND "DATEFIELD1"=?".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" could not
UPDATE table "[MSDASQL]".

Why not make things easier? Does PervasiveSQL not support direct updates via a linked server?
UPDATE TLLINKSERVER...TABLE1
SET DATEFIELD = '2013-07-15'
WHERE JOBID = '00-00-111111';
Or maybe:
SELECT * FROM OPENQUERY(TLLINKSERVER, 'UPDATE TABLE1
SET DATEFIELD = ''2013-07-15''
WHERE JOBID = ''00-00-111111'');
While the UPDATE OPENQUERY syntax you're using is supported for SQL Server linked servers, I'm not sure that's true for other platforms such as PervasiveSQL...

This is how I update table sin Oracle from SSMS.
The Linked server name in this case is MyLinkedServer.
I am updating the column CONTACT_EMAIL to MyEmail#MyDomain.COM where the STATE is one of the following (KY,OH,NY,PA,VA,DC):
UPDATE L
SET L.CONTACT_EMAIL ='MyEmail#MyDomain.COM'
FROM OPENQUERY(MyLinkedServer, 'SELECT * from MyTable')L
WHERE L.STATE IN('KY','OH', 'NY','PA','VA','DC')
OPENQUERY method works perfectly.

Related

migrate existing biztalk server database from sql server 2008 R2 to sql server 2012

we are planning to move biztalk database from one place to another as well as upgrade the sql server.
the initial database is in sql server 2008 R2 and target is sql server 2012.
but the thing is that we have to set up database on another system,
i tried to search it on msdn but they are providing reference to upgrade from 2005 to 2008 , or moving database from one server to another.
do you think that will work in my case !!
i found this article.http://msdn.microsoft.com/en-us/library/ee378547%28v=bts.10%29.aspx
relating to upgrading as well as moving..
but this is quite older one.
how can i upgrade as well as move biztalk database from sql server 2008 R2 to sql server 2012 on a different system (side by side upgrade).
do i have to follow same steps as upgrading a normal database from sql server 2008R2 to sql server 2012 or some other one ??
As long as the SQL Server edition (2012 in your case) you are migrating to is supported by your BizTalk Server edition, you can follow the procedure to move BizTalk databases.
You can check the version compatibility here.

How to connect Adempiere (or any PostGreSQL) to SSRS 2012 Express?

Has anyone connected Adempiere (ERP) (or any PostGreSQL db) to SQL Server 2012 Express?
There used to be an IT manager to help me out with this, but now i'm left alone with this.
I downloaded the free Sql Server 2012 Express and wanted to use the SSRS for Adempiere. It seems its running on the SQL Server 2010 for SSRS.
I have already added the ODBC Data Sources for 32 Bit. My computer is using 64bit, is there any incompatibility? I'm not sure if my server is 32 or 64bit.
I've tried following the instructions on http://postgresblog.blogspot.com/ but to no avail.
I already have Crystal Report running, so i'm sure its possible to run 3rd party software for Adempiere.
Anyone knows how i can use SSRS for Adempiere? Thanks!
Since you're using Express edition, if you're trying to connect to any Data Source other than an database on the same SQL Server instance it won't work.
See Features Supported by Reporting Services in SQL Server Express.
From that article:
Report data sources must be SQL Server relational databases that run
locally in SQL Server Express.
Also:
Analysis Services, Oracle, XML, SAP, SQL Server Integration Services
(SSIS), OLE DB, and ODBC data sources are not supported.
You're going to need a different edition to connect to an ODBC Data Source.

Try to read foxpro dbf and getting error:Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)"

I try to read Foxpro DBF files with Microsoft SQL Server 2008 R2.
I write this query:
SELECT *
FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;
SourceDB=D:\DB\;
SourceType=DBF',
'SELECT * FROM MyTable')
Also I installed 'VFPOLEDB' provider to run the query. But it does not run and I got this error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "MSDASQL" for linked server "(null)" 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 "(null)".
I ran this query correct before,but it does not run now,I don't know why!I Google that but it doesn't helpful.
How can I read DBF files using SQL Server 2008 R2? My DBMS are running on Windows 7 OS, and also Windows 2003 Server.
Thanks in advance,
Mohsen.
This is a problem with SQL Server 2008 R2. You can downgrade to SQL Server 2005 or SQL Server 2008 to get this working again.

'OBJECT_SCHEMA_NAME' is not a recognized built-in function name

I'm trying to run a script to set up tsqlt on SQL server 2008 r2 and getting this error
'OBJECT_SCHEMA_NAME' is not a recognized built-in function name.
on another machine with SQL 2008 r2, the script runs fine.
I can't see any difference in the users or permissions in the sql server setup for each respective machine.
this is the statement that throws the error:
CREATE FUNCTION tSQLt.Private_GetOriginalTableInfo(#TableObjectId INT)
RETURNS TABLE
AS
RETURN SELECT CAST(value AS NVARCHAR(4000)) OrgTableName,
OBJECT_ID(QUOTENAME(OBJECT_SCHEMA_NAME(#TableObjectId))
+ '.' + QUOTENAME(CAST(value AS NVARCHAR(4000)))) OrgTableObjectId
FROM sys.extended_properties
WHERE class_desc = 'OBJECT_OR_COLUMN'
AND major_id = #TableObjectId
AND minor_id = 0
AND name = 'tSQLt.FakeTable_OrgTableName';
GO
If this is in fact on SQL Server 2008 R2, your database is in SQL Server 2000 compatibility mode. You can tell what mode you're in now:
SELECT name, compatibility_level
FROM sys.databases
WHERE name = N'your_database';
If this is 80 you will need to move up (but this will require testing):
ALTER DATABASE your_database SET COMPATIBILITY_LEVEL = 100;
If you can't move up, then you can always get the schema name by joining to sys.schemas instead of relying on the built-in function.
That said, if you are on SQL Server 2005 RTM (as implied in a comment), OBJECT_SCHEMA_NAME was introduced in SQL Server 2005 Service Pack 2. You should not be running any system on SQL Server 2005 RTM anymore. Go install SP4 and you will be able to use this function.

Creating a user without an associated login is not supported in SQL Server 2008 R2

When scripting a SQL Server 2000 database, on an SQL Server 2000 version of SQL Server, with SQL Server Management Studio 2008 R2 (10.50.1617.0) i get the error:
Creating a user without an associated login is not supported in SQL Server 2008 R2.
With the full stack trace:
Microsoft.SqlServer.Management.Smo.SmoException: Creating a user without an associated login is not supported in SQL Server 2008 R2.;
at Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
What is a good way to resolve this issue.
i've considered:
creating a login (and incur the wrath high atop the thing)
deleting the user (and incur the wrath from high atop the place)
select some rather than all objects to script, and don't script the user that offends SQL Server 2008 R2
But i'll let people on SO post answers, get answers upvoted, and accept an answer that best solves the problem.
As instructed. Just don't script the database users that have no associated login. You can do this in the Tasks > Generate Scripts wizard (pointing 2008 or later SSMS at your 2000 instance) by choosing to select specific database objects and unchecking any troublesome users:
I suspect that your SQL Server 2000 database has user aliases: these were required in SQL Server 6.5 in some circumstances because it was, er, crap,
Note what MSDN says:
sp_addalias is provided for backward compatibility. Microsoft® SQL Server™ version 7.0 provides roles and the ability to grant permissions to roles as an alternative to using aliases.
Run sp_helpuser on the SQL Server 2000 box and review the output and remove them