Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Excel VBA sql doesn't have all functions??

Author  Topic 

krausr79
Starting Member

19 Posts

Posted - 2012-09-12 : 11:44:52
I do all my sql statements in excel vba using ADODB connections, commands, and recordsets. Sometimes when I'm looking online for new techniques I see sql commands that look cool but produce errors when I try to use them. I was able to use rank() and partition, but I was not able to use Row_number(). 'Max' works nicely but it always throws a fit when I try to get 'top' to work right.

Is there something I could be doing to use all the sql out there?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-12 : 11:48:11
It doesn't sound like it is Excel, or VBA, or ADO.Net. More likely the queries themselves might be the culprit.

Can you post some of the queries that are causing you problems? I would have thought that it might be because you are using a version that dos not support ROW_NUMBER function, but if RANK works ROW_NUMBER should as well.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-12 : 12:01:36
quote:
Originally posted by krausr79

I do all my sql statements in excel vba using ADODB connections, commands, and recordsets. Sometimes when I'm looking online for new techniques I see sql commands that look cool but produce errors when I try to use them. I was able to use rank() and partition, but I was not able to use Row_number(). 'Max' works nicely but it always throws a fit when I try to get 'top' to work right.

Is there something I could be doing to use all the sql out there?


where are you trying to use this?


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

krausr79
Starting Member

19 Posts

Posted - 2012-09-12 : 12:24:35
Yes, I was doing row_number wrongI(); I had to follow it with over().

Select top 5 * From qgpl.foreledg

Is not working.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-12 : 12:54:35
what do you mean by not working

are you gettong error or is it not giving you intended result?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -