I'm using vb.net, and I've created a sql statement that I use with a OleDBConnection object. When I run my sql (below) the ExecuteReader throws an error (also below). The problem is that it works on the 50+ en-US machines that it's run on, but now I've got my first client in Germany, and it fails on their machine. I set my dev machine to German settings to try to replicate the issue, but it works just fine for me. I copied-over their exact data file and it works on my machine. So seemingly it has to do with it being a non en-US machine?
Here is the SQL statement:
SELECT Val(IIf(IsNumeric([Sequence]), [Sequence], '0')), *
FROM MyTable
ORDER BY SomeOtherField, 1
So in short, I want to order by the sequence column secondarily, but in the event that Sequence isn't numeric I'll just give it a '0' so that it allows the sort to take place based on the dynamic column '1' I am creating/selecting on-the-fly.
Here is the error on the German machine:
Fuer mindestens einen erforderlichen Parameter wurde kein Wert angegeben.
(Roughly translated: For at least one required parameter was not specified value)
Does anyone have any ideas as to what my issue might be? Thanks in advance for any assistance you can provide to me.
-Greg
This is just a guess. But, try replacing the iif() with a case statement:
SELECT (case when IsNumeric([Sequence]) = 1 then [Sequence]
else '0'
end),
mt.*
FROM MyTable mt
ORDER BY SomeOtherField, 1
I suspect that your other systems are using Access, and the German system is using SQL Server. SQL Server does not recognize iif.
Related
We have two SQL Servers and on both of them FTS is enabled and should be configured the same way. Both run with the same server version. The SQL Server we have problems with runs in Azure.
I also have checked the wordbreaker language versions with the following statement. Both have the version 14.0.4763.1000 installed for German (1031).
EXEC sp_help_fulltext_system_components 'wordbreaker'
On one server, we do not get results properly, even though the word we are searching for exists in the table. With the following query we don't get any results:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehmen*"', LANGUAGE 1031)
But with the keyword "Einzelunternehm" instead of "Einzelunternehmen" we get the results we are looking for:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehm*"', LANGUAGE 1031)
We have absolutely no clue what the issue is. Does anybody have the same problem or have any idea what we have done wrong?
Thx
I have queries created in Microsoft Query to run in Excel with VBA.
They work in different computers but there's one computer where it doesn't work.
In that computer the queries still work except the ones that use CTEs.
A normal query like the following works:
SELECT
TBL.COL
FROM
DB.TBL TBL;
But when it has a subquery (CTE) like the following:
WITH
SUBQUERY AS (
SELECT
TBL.COL
FROM
DB.TBL TBL
)
SELECT
SUBQUERY.COL
FROM
SUBQUERY;
It runs but doesn't retrieve any data.
It doesn't even show the column name like it would if it worked but had 0 records returned.
The query shows the warning message:
SQL Query can't be represented graphically. Continue anyway?
Which is normal and shows in any computer, but it also shows another warning message after:
SQL statement executed successfully.
Which only appears in that computer when it doesn't work.
I need to be able to use them for the queries that I have made.
Using temporary tables would maybe work but I don't have the permissions required to try.
I tried using inline views but they duplicate the data.
I have queries created in Microsoft Query to run in Excel with VBA.
... but there's one computer where it doesn't work.
Common table expressions (i.e., the WITH clause) were not introduced until release 9 of the database. Since ODBC is involved (Microsoft Query), the most likely reason for your situation is that the computer that does not work has an out-dated (pre-release 9) version of the Oracle Client installed.
Compare the Oracle Client installations between a client computer that works and one that does not, to find whether this is the case. If it is, upgrade the Oracle Client on the problematic machine.
I think you can use...
SELECT
SUBQUERY.COL
FROM
(
SELECT
TBL.COL AS COL --or (TBL.COL COL) or ( COL ) #if not duplicate with any
FROM
DB.TBL TBL
) SUBQUERY;
I am running the following SQL query using the Navicat client for Mac:
SELECT
CREATE_TIME, EMAIL, NUMBER, SNID
FROM
LOG_DEVICE
WHERE
CID = 'T-MOB'
AND NUMBER LIKE '12345678%'
But when I do, I get Unexpected EOF from the server. I have tried adjusting the query to this:
SELECT
CREATE_TIME, EMAIL, NUMBER, SNID
FROM
LOG_DEVICE
WHERE
CID = 'T-MOB'
and it will run without issue. I'm guessing that it has something to do with the NUMBER column. I know the column has NULL and empty values, but it seems that the error happens at the end of the file.
What is causing this, and how can I handle it? Is there a way to handle the error so that I can complete the query?
UPDATE:
I am running SQL 2005. Not sure that makes a difference, but I figured I'd mention it.
In true Microsoft fashion, this issue was solved by running the exact same query from a PC, using HeidiSQL as the client.
I am having an issue with SSRS 2005. I have a case statement that that works fine in other queries and reports, but errors on the latest report for some reason. I don't believe its an issue with the query rather an issue with reporting services. The error I get is "Query execution failed for data set, invalid column name 'Status'.Has anyone else run into this issue? how did you resolve? The code is below just in case
SELECT Task
, Account_Num
, CASE WHEN DATEDIFF(dd,GETDATE(),Due_Date) < 0
THEN 'Overdue'
WHEN DATEDIFF(dd,GETDATE(),Due_Date) < 3
THEN 'Alert'
ELSE 'Okay'
END AS Status
FROM MyDb
Try square brackets around the reserved word [status]
Sometimes this is due to using an alias. Sometimes, one is not allowed to use the alias and must type out the fully-qualified name.
ourDatabase.ourTable.ourColumnName
This may or may not apply to the OP's situation, however. I have not tried it with the Case statement.
I get this error on many of the TQuery connected to Interbase via BDE. Exact message is:
General SQL Error. Dynamic SQL Error, SQL error code = -804, SQLDA missing or incorrect version, or incorrect number/type of variables.
The message appears as soon as I try to open/edit the TQuery at design time, or when a Post is done at run time. For the Post action at run time, I have found that if I Prepare the table before the Post, the Post is done nicely.
I have read Craig Stunz's Weblog about same error. The parameters I have are all integers. Database is small, Interbase 2009, and I see no particular patterns with the queries that show the error message (it can be selected, deleted, updated etc.). Running the query out of Delphi is just fine.
The tables have numeric data type (15,2).
The tables have been backup/restored from Interbase version 5 - dialect 1 to Interbase 2009.
Actual ODS is 13.1 (Interbase 9).
No UDFs.
Any idea what is wrong?
[UPDATE]
Samples of query not showing the error / showing the error:
No Error:
select MASTER_ID, GL_ACCT_DR, GL_ACCT_CR,
VENDOR_ID, VENDOR_CODE,
ORDER_NO, ORDER_DATE, INVOICE_NO, INVOICE_DATE,
DESCRIP, BUYER, SHIP_VIA, FOB, IS_FREIGHT_PREPAID,
IS_TAXABLE, TERMS_ID, TERMS_CODE,
DISC_DAYS_OR_DATE, DISCOUNT_PCT, NET_DAYS_OR_DATE,
BILL_TO_LOC_ID, SHIP_TO_LOC_ID,
BILL_TO_LOC_CODE, SHIP_TO_LOC_CODE,
DISCOUNT_DATE, DUE_DATE
from P_JRNTRN where
ENTITY_DB_ID = :PRIMARY_DB_ID and
SRC_MODULE = 'PJ'
order by INVOICE_NO
Parameter is Integer.
Error:
select * from P_JRNTRN where
BATCH_ID = :BATCH_ID
order by MASTER_ID
Parameter is Integer.
[UPDATE] ...
I've not been able to resolved this problem so i moved to IBDAC in replacement of the BDE. I get no more error.
Thanks to all.
I had the same problem. I was using DataDirect ODBC InterBase driver.
When I switched to the official Firebird ODBC driver, I solved it.