I do something like this, based on MSSQL7.0 Response codes. There's of 
course many more....

<cftry>
         <cfquery datasource="dns" name="myQuery">
         select field1,field2
         from mytable
         </cfquery>

         <cfcatch>
                 <!--- catch various SQL error and attempt to fix them an 
re-run the insert --->
                 <cfparam name="cfcatch.sqlstate" default="">
                 <cfswitch expression="#trim(cfcatch.sqlstate)#">
                         <cfcase value="22001">
                                 <!--- data is being truncated, adjust the 
field size's --->
                         </cfcase> 


                         <cfcase value="S0002">
                         <!--- table does not exist --->
                         </cfcase>

                         <cfcase value="S0022">
                         <!--- missing column --->
                         </cfcase>
                 </cfswitch>
         </cfcatch>
</cftry>



At 12:32 PM 11/11/02 -0500, you wrote:
>Is there any way to capture the response from SQL Server in a variable
>to display to an end user?
>
>For example, if I allow a user to run an arbitrary SQL command against
>the server using a web interface and they run a DROP TABLE on a table
>that doesn't exist - instead of erroring, how can I grab the actual
>response from SQL Server? Anyone have any ideas?
>
>Joshua Miller
>[EMAIL PROTECTED]
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to