Firstname will not need to be in single quotes no. You do no need the command GO in this case you only require it in multiple batch executions.
-----Original Message----- From: Bryan Stevenson To: SQL Sent: 22/02/2005 23:15 Subject: Re: How 2 convert cfquery to TSQL (MS SQL stored proc) 2 guesses.... 1) '@firstname' may not need to be in single quotes (shot in the dark) 2) You have to close the IF somehow ;-) Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: [EMAIL PROTECTED] web: www.electricedgesystems.com ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "SQL" <[email protected]> Sent: Tuesday, February 22, 2005 3:08 PM Subject: Re: How 2 convert cfquery to TSQL (MS SQL stored proc) > How about doing this in TSQL? > > select * > from profiles > where 0=0 > <cfif form.firstname neq ''>and firstname='#form.firstname#'</cfif> > > I'm having hell of a hard time getting this to work. This is how I coded > it > in TSQL but it just won't work:( > > CREATE PROCEDURE dbo.sp_test > @firstname varchar(100)= 'jenna' > AS > > select * > from profiles > where 0=0 > IF @firstname is not NULL > and firstname='@firstname' > GO > > This sucker juz will NOT work:( Waaaaaaaaaaaaaaaaah:( > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:6:2153 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
