You could use the execsql statement for SQL Server. You just have to set up a string containing the SQL and then execute it in a Stored procedure...
But you will loose the benefit of a sql server stored procedure of precompiled statements, because the sql query parser does not know the sql-statement yet. <cfgreetings from="Gert Franz" to="Reader" function="railo core developer" location="switzerland"> BTW: Anyone care to see how Ben Forta did in Switzerland. Just goto www.railo.ch/gallery -----Urspr�ngliche Nachricht----- Von: Pardeep Singh [mailto:[EMAIL PROTECTED] Gesendet: Montag, 21. Februar 2005 20:32 An: CF-Talk Betreff: How u convert this cfquery to TSQL for MS SQL stored procedure Does anyone know how to convert this cfquery to TSQL so it can be executed through a stored procedure instead in MS SQL 2000? The first condition just sees if a var exists and makes sure its not null, the second one does the same thing but feeds the query a list: <cfquery name="test" datasource="abcinc"> select * from profiles where 0=0 <cfif isdefined('form.firstname') and form.firstname neq ''>and firstname='#form.firstname#'</cfif> <cfif isdefined('zipsreturned') and zipsreturned neq ""> and zipcode in (<cfqueryparam cfsqltype="cf_sql_varchar" value="#zipsreturned#" list="yes">)</cfif> </cfquery> I'm having a tuff time creating the condition in the WHERE part to check if the variable form.firstname exists first, and then to make sure its not null. I'm trying to build a search form and then have the search criteria queried in a MS SQL Server stored procedure directly for the sake of speed. I appreciate any help. Thanks. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195826 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

