none
Ad Hoc Query

    Question

  • Hi, i want to learn how to build Ad Hoc queries in sql. I checked online but didnt find any nice article.

    Can anybody suggest me some nice articles on ad hoc query?

    Thanks

    Tuesday, August 23, 2011 4:45 PM

Answers

  • Here is an article that discusses "ad hoc distributted queries":

    http://technet.microsoft.com/en-us/library/ms187569.aspx

    Here is an article about application roles and it discusses "... If ad hoc access to a database is not required, users and Windows NT 4.0 or Windows 2000 groups do not need to be granted any permissions because all permissions can be assigned by the applications they use to access the database. In such an environment, standardizing on one system-wide password assigned to an application role is possible, assuming access to the applications is secure. ...":

    http://msdn.microsoft.com/en-us/library/aa905193(v=sql.80).aspx

    It might be good if you did some investigating of the generic term "ad hoc"; there are certainly articles available for ad hoc reporting.  Also, you need to do some of your own investigating.  You can do searches either in this forum or over whatever search engine you choose.  You don't need to be a leaner.

     


    • Proposed as answer by Naomi NModerator Monday, August 29, 2011 5:43 PM
    • Marked as answer by KJian_ Thursday, September 01, 2011 9:30 AM
    Monday, August 29, 2011 5:24 PM

All replies

  • The term "Ad Hoc" just means that it is a query that runs outside of the scope of a stored procedure or function -- that is, a query that is standard SQL.  You can run ad hoc query from pretty much any query tool.  The standard query interface through the enterprise manager, TOAD, AQT, Access, Excel -- like I said: pretty muc any query tool.

    You can also run ad hoc queries from any application that has an SQL connections.  On please where the term "ad hoc" applies has to do with setting application level security privileges.  Application level security privileges can only be set from an ad hoc query.

    Tuesday, August 23, 2011 4:49 PM
  • As Kent already suggested you can run any query from the SSMS (SQL Server management Studio).

    Ok, but I feel that you are in search for the Dyanamic SQL. if you are looking for the dynamic SQL then the below are the nice articles to read

    http://www.sommarskog.se/dynamic_sql.html

    http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-1

    http://www.codeproject.com/KB/database/Building_Dynamic_SQL.aspx

     

     


    Nothing is Permanent... even Knowledge....
    My Blog
    Tuesday, August 23, 2011 4:53 PM
  • Thanks Kent, do you know any article on Ad Hoc Queries? i wanna know more about it.

    Wednesday, August 24, 2011 2:41 PM
  • Here is an article that discusses "ad hoc distributted queries":

    http://technet.microsoft.com/en-us/library/ms187569.aspx

    Here is an article about application roles and it discusses "... If ad hoc access to a database is not required, users and Windows NT 4.0 or Windows 2000 groups do not need to be granted any permissions because all permissions can be assigned by the applications they use to access the database. In such an environment, standardizing on one system-wide password assigned to an application role is possible, assuming access to the applications is secure. ...":

    http://msdn.microsoft.com/en-us/library/aa905193(v=sql.80).aspx

    It might be good if you did some investigating of the generic term "ad hoc"; there are certainly articles available for ad hoc reporting.  Also, you need to do some of your own investigating.  You can do searches either in this forum or over whatever search engine you choose.  You don't need to be a leaner.

     


    • Proposed as answer by Naomi NModerator Monday, August 29, 2011 5:43 PM
    • Marked as answer by KJian_ Thursday, September 01, 2011 9:30 AM
    Monday, August 29, 2011 5:24 PM