I'm having a mismatch error when calling Round() in an SQL query - sql

I have a simple Access 2007 database and when I run any of those sql queries
SELECT Round(CDbl(15.243),2)
Or
SELECT Round(15.243,2)
I'm having a type mismatch error in the criteria expression
This also doesn't work
SELECT Round(15,0)
Do you have any clue?
Thanks a lot

Related

DB2 SQL Error: SQLCODE=-901, SQLSTATE=58004, SQLERRMC=Invalid collation ID, DRIVER=4.21.29

Trying to execute the statement
select *
from RU_VARIANCE_HISTORY
but I'm getting the error
DB2 SQL Error: SQLCODE=-901, SQLSTATE=58004,
SQLERRMC=Invalid collation ID, DRIVER=4.21.29
Tried searching but unable to find the solution.
This can happen if DB2 thinks the statement is really too long or too short. Try adding a semicolon to the end of your statement - this worked for me with the same error.

how to pull a column named "NUMBER" from Oracle through Ms Query in Excel

I know, I know...The column shouldn't be named "NUMBER", but it was here before I was, and I can't change it for now. At the moment, I only have read access to this database, and I was told it would be changed...soonish...
I've tried referencing it as Table."NUMBER" and that works when querying directly from Oracle, but for some reason, I still get the infamous ORA-01747: invalid user.table.column, table.column, or columns specification error when I reference it that way in MS Query. I also tried Table.""NUMBER"", "Table."NUMBER"", Table.'"NUMBER"', and 'Table."NUMBER"', but each of these gave me an error from MS Query saying it wasn't expecting the punctuation in the select column list.
Does this have something to do with the way MS Query handles double quotes? Is there any way to make sure that the double quotes around NUMBER make it to Oracle without MS Query throwing an error?
My query is really simple...except for this part.
Select Table."NUMBER"
From Table
Thanks in advance for any help.
try
SELECT table."NUMBER" AS a_number FROM table
or create a view referencing the table and rename the column as required
Aliases solve a lot of problems with names. I suspect that the issue you were having is not with running the query in Oracle but the result that comes back from Oracle. An alias allows the result set to be usable by Access.

MS Access SQL Server DB - Query Syntax for CAST Function

I have converted an Access db (.mdb) to SQL Server. In the meantime I still need to use Access as a front end until new application forms are constructed. Can someone tell me what I might do to fix the situation where:
In Access 2007, a query such as:
SELECT *
FROM TransactionTotals
WHERE TransactionTotals.[Date]= Date()
ORDER BY TransactionTotals.EntryID DESC;
worked, however since the Date() function will not work with SQL Server, with help in a previous post the correct syntax is:
SELECT *
FROM TransactionTotals
WHERE TransactionTotals.[Date]= CAST(GETDATE() AS DATE)
ORDER BY TransactionTotals.EntryID DESC;
BUT! Although the code above will work in a direct SQL Server query (SQL Management Studio), it will be tossed out in Access with a Syntax Error response on the WHERE clause.
Can something be done in Access so I can still run my query bound forms.
I usually do exactly what you do, Access first before migration to SQL server. Access has some really weird syntax compared to server type databases especially when it comes to JOIN clauses and dates, GETDATE() only works on SQL Server, in Access, try this...
SELECT *
FROM TransactionTotals
WHERE TransactionTotals.[Date]= Format(NOW(),"General Date")
ORDER BY TransactionTotals.EntryID DESC;
Feel free to change the format of the date, with or without time.

MS Access database: Select statement error

I am trying following query in MS Access 2010 database:
Query:
SELECT ID, Title, Priority, Workflow_Instance_Step_ID:ID
FROM Task
Error:
Error Source: Microsoft Office Access Database Engine
Error Message: Syntax error (missing operator) in query expression 'Workflow_Instance_Step_ID:ID'
I know that field "Workflow_Instance_Step_ID:ID" is giving error as it has ':' operator, but I cant change it as it it coming from share point list.
I have tried '[Workflow_Instance_Step_ID:ID]' but still its giving an error.
Please give me your suggestion on the same.
I am unable to recreate your issue, at least with a native Access table in Access 2010. I created a table named [baz] with a single text field named [foo:bar]
foo:bar
-------
this
is
a
test
and the query
SELECT [foo:bar] FROM baz;
works fine, so a field name containing a colon character does not seem to cause problems for Access SQL as such.
An ODBC linked table to a SQL Server table with the same structure does not cause problems either.
In both cases the queries were run from within Access 2010 itself.
So we might be in diagnosis mode, so lets try
SELECT * FROM Task
and then look at the FieldNames that come back.

Passing parameters through Excel to an Informix DB works through MS Query but fails when returned to Excel due to General Error

I require to query an informix database using parameters and Excel. When the query is executed in Microsoft Query the dataset is fetched and returned succesfully, when I attempt to return to Excel the following error occurs:
> [Informix][Informix ODBC Driver]General Error.
The query is as follows:
SELECT DISTINCT t1.r1, t1.r2, t2.r3, t2.r4
FROM informix.t1, informix.t2
WHERE t1.r1 = t2.r5 AND ((t2.r3=?) AND (t2.r4 =?))
Hope you can help as I'm new to this.
Thanks in advance