[ODBC] Differentiating between Insert/Update/Delete and Select

답변됨 [ODBC] Differentiating between Insert/Update/Delete and Select

  • 2012년 7월 21일 토요일 오전 5:11
     
     
    I was wondering how i can differentiate between a SQL Select statement and an insert/update/delete without parsing the SQL string.  Any help is greatly appreciated.

모든 응답

  • 2012년 7월 21일 토요일 오전 6:34
     
     

    Hello,

    What are you trying to archive / why do you want to differentiate between the different DML comands?


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing

  • 2012년 7월 21일 토요일 오후 3:39
     
     
    i'm wanting to make an AdHoc query program like SQL management studio where i can send any SQL statement and then if it returns rows i can grab them or if it is a statement that doesn't return rows i can state how many rows were affected
  • 2012년 7월 21일 토요일 오후 4:13
     
     답변됨

    You should not need to know in advance whether there are any results coming back or not. In fact this can be difficult, in case the batch include a stored procedure. Or there is a trigger that returns result set.

    I have not worked much with the ODBC API, but it is perfectly possible to do this in all other APIs I've worked with, so why not ODBC?


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    • 답변으로 표시됨 Iric WenModerator 2012년 7월 30일 월요일 오전 8:25
    •  
  • 2012년 7월 23일 월요일 오전 6:07