: 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
-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
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
:[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
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]
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(*)
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
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]
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
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
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
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
-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
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
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
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
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
17 matches
Mail list logo