Re: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Ali Awan
: RE: SQL: Passing vars to a LIKE statement thanks but it is not helping, here is my stored proc and the error msg I receive CREATE PROCEDURE GetMonthlyJoins AS DECLARE @MONTH varchar(3), @MONTHNBRint, @YEARint, @did datetime, @countint, @likevar varchar(25) IF object_id('#MonthlyJoins

RE: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Eric Creese
-Original Message- From: Ali Awan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 11:21 AM To: CF-Talk Subject: Re: SQL: Passing vars to a LIKE statement Eric, Can you try just doing this first? AND demographicvaluedesc LIKE @month+'%' And do you still get the error? Then also try

Re: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Ali Awan
Message- From: Ali Awan [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 11:21 AM To: CF-Talk Subject: Re: SQL: Passing vars to a LIKE statement Eric, Can you try just doing this first? AND demographicvaluedesc LIKE @month+'%' And do you still get the error? Then also

RE: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Eric Creese
:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 12:38 PM To: CF-Talk Subject: Re: SQL: Passing vars to a LIKE statement Eric, Glad that worked :) I have a suggestion as to your next problem. First create a new variable Then set the variable to the string you were converting. Then do a convert

RE: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Eric Creese
Now the final question. How do yousuccessfully pass a table name dynamiclly gereated as a varible in the FROM portion of a SELECT clause? ie. SELECT count(*) FROM @varTableName [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Re: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Ali Awan
For this question, I would just do an inline sql query in ColdFusion and use a coldfusion variable for the tablename: select count(*) from #tablename# However, if it must be done in a stored procedure, then the following should work: @sqlstring varchar(255) SELECT @sqlstring = 'SELECT count(*)

RE: SQL: Passing vars to a LIKE statement

2004-09-23 Thread Eric Creese
I am simply running the stored proc and dumping the information to the page not passing any parameters -Original Message- From: Ali Awan [mailto:[EMAIL PROTECTED] Sent: Thu 9/23/2004 6:03 PM To: CF-Talk Cc: Subject: Re: SQL: Passing vars to a LIKE statement [Todays Threads

SQL: Passing vars to a LIKE statement

2004-09-22 Thread Eric Creese
I need to pass some varibles into a LIKE clause in a SELECT statement. I am having trouble with the format. AND valuedesc LIKE '[EMAIL PROTECTED]@year%' is what I was doing and know this is wrong cause it see that garb as a literal string. How do I pass this so the vars show? [Todays Threads]

Re: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Ali Awan
I need to pass some varibles into a LIKE clause in a SELECT statement. I am having trouble with the format. AND valuedesc LIKE '[EMAIL PROTECTED]@year%' is what I was doing and know this is wrong cause it see that garb as a literal string. How do I pass this so the vars show? Eric, I

Re: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Brett Barnhart
I need to pass some varibles into a LIKE clause in a SELECT statement. I am having trouble with the format. AND valuedesc LIKE '[EMAIL PROTECTED]@year%' is what I was doing and know this is wrong cause it see that garb as a literal string. How do I pass this so the vars show? Here is

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Eric Creese
thanks, but I am doing this in sql stored proc not a cf page. forgot to mention this -Original Message- From: Brett Barnhart [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 1:22 PM To: CF-Talk Subject: Re: SQL: Passing vars to a LIKE statement I need to pass some varibles

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Eric Creese
1:21 PM To: CF-Talk Subject: Re: SQL: Passing vars to a LIKE statement I need to pass some varibles into a LIKE clause in a SELECT statement. I am having trouble with the format. AND valuedesc LIKE '[EMAIL PROTECTED]@year%' is what I was doing and know this is wrong cause it see that garb

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Jason Reichenbach
-Talk Subject: Re: SQL: Passing vars to a LIKE statement I need to pass some varibles into a LIKE clause in a SELECT statement. I am having trouble with the format. AND valuedesc LIKE '[EMAIL PROTECTED]@year%' is what I was doing and know this is wrong cause it see that garb as a literal

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Eric Creese
I am still lost -Original Message- From: Jason Reichenbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 3:22 PM To: CF-Talk Subject: RE: SQL: Passing vars to a LIKE statement Pass the percent signs as part of your var... Don't know why it works but it does

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Jason Reichenbach
I'm assuming you are posting from a form or the like and calling this SP. Pass this from your cf page when you call the Sp @yourspvar = formvar% That way the @yourspvar is a string when it comes into the sp and no need to do any of the % or single quotes in your SP just simply use whatever LIKE

Re: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Qasim Rasheed
Can you try this demographicvaluedesc LIKE ''%'[EMAIL PROTECTED]'%'' i.e without month. I think single quote before% has to be escaped. - Original Message - From: Eric Creese [EMAIL PROTECTED] Date: Wed, 22 Sep 2004 16:16:25 -0500 Subject: RE: SQL: Passing vars to a LIKE statement To: CF

RE: SQL: Passing vars to a LIKE statement

2004-09-22 Thread Eric Creese
not passing a var from a cf page at all cf page simply runs the sp and out puts the data -Original Message- From: Jason Reichenbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 4:37 PM To: CF-Talk Subject: RE: SQL: Passing vars to a LIKE statement I'm assuming you