SQL COUNT(*) problem

I am preforming a simple query:

SELECT COUNT(*) FROM MyTable

The query fails when it's preformed on sql server and succeeds when sent to an Oracle database.
The Error code is: -2147217887
The Error description is:
"Database Error: Microsoft OLE DB Provider for Sql Server, Multiple-step OLE DB operation generated errors. Check each OLE DB s"

What could be the problem ?
Are there any special settings for the database (indexes or identities) that are critical for a SELECT querys that contain the COUNT function ?

Comments

  • : I am preforming a simple query:
    :
    : SELECT COUNT(*) FROM MyTable
    :
    : The query fails when it's preformed on sql server and succeeds when sent to an Oracle database.
    : The Error code is: -2147217887
    : The Error description is:
    : "Database Error: Microsoft OLE DB Provider for Sql Server, Multiple-step OLE DB operation generated errors. Check each OLE DB s"
    :
    : What could be the problem ?
    : Are there any special settings for the database (indexes or identities) that are critical for a SELECT querys that contain the COUNT function ?

    You could maybe allready have your answer but anyway.
    You propably should add some field on your query which actually presents in your table. I am not sure but that feels logical to me.
    like: SELECT yourfielf, COUNT(*) FROM MyTable
    Best regards
    Toni Storhannus
    :

  • : You could maybe allready have your answer but anyway.
    : You propably should add some field on your query which actually presents in your table. I am not sure but that feels logical to me.
    : like: SELECT yourfielf, COUNT(*) FROM MyTable

    This statement will cause an error unless you "GROUP BY yourfielf"
    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories