Reputation: 37
The error I get is:
The column "EngDescAlt" (compile-time ordinal 2) of object "select * from MstBusiness" was reported to have a "DBCOLUMNFLAGS_ISLONG" of 128 at compile time and 0 at run time.
I get the same error for various columns in a couple of tables, the only difference each time is the column name and the table name, and I cant figure out how to fix it. Any ideas?
Just by the way using OpenQuery doesnt work as that is what I was already using.
Any help is appreciated.
SELECT Z_ID AS BusinessID, EngDescAlt AS Description
FROM OPENQUERY(<LinkedServer>, 'select * from <Tablename>') AS U2_<Tablename>
Upvotes: 1
Views: 11133
Reputation: 37
For some reason restarting MS SQL SERVICES on the server fixed the problem. It seems it had something to do with a problem that was fixed and required a restart to enact. Sorry I cant be more specific as to what fixed the problem.
Upvotes: 2
Reputation: 650
I just noticed you edited your question, posting your query.
A great way to debug, is to test small steps toward your goal... so you can see exactly which step introduces an error.
First, can you connect directly to the target server, to test your queries without OPENQUERY?
If so, then try the simple select from within SSMS (SQL Server Management Studio):
SELECT Z_ID AS BusinessID, EngDescAlt AS Description
FROM <Tablename>
If that works, try:
SELECT Z_ID AS BusinessID, EngDescAlt AS Description
FROM (select * from <Tablename>) AS U2_<Tablename>
And try running the openquery in SSMS, in a query window that is connected directly to that target server (rather than as a linked server):
SELECT Z_ID AS BusinessID, EngDescAlt AS Description
FROM OPENQUERY(<LinkedServer>, 'select * from <Tablename>') AS U2_<Tablename>
Finally, a question: what environment have you been running the OPENQUERY in? Has it been from within SSMS on another server / your workstation? Or has it been from some other environment/language/tool? If you haven't been executing the openquery in SSMS, try that too, accessing as a linked server.
And please report back the results and/or messages.
Upvotes: 1