Ask a Question related to Coldfusion Database Access, Design and Development.
-
tranzformerz #1
SQL Stored Procedure Problem "Single Quotes"
Quotes is something we all should be aware of when passing values to a Stored
Procedure. However, this specific scenario I am really stuck on.
SQL Stored Procedure:
select *
from tbl_table
where forum_id IN ('first value,'second value')
I'm trying to pass "First Value & Second Value" using a variable. The "QUOTES"
gives problems when passing it to the procedure. I tried using other datatypes,
but no luck. Any thoughts?
tranzformerz Guest
-
Passing "%" wild card to stored procedure
Hi everyone, This may be a simple question: When I pass "%" (without the quotes) in an asp page to a stored procedure, I get the Incorrect... -
Urgent: help needed : "Problem with double quotes"
Hi, I want to call a PERL program from MS-DOS batch file. Following is just an example, the string may inturn have double quote or single quote.... -
lock probs, implicit "update statistics for procedure .." ?
Whe recently sometimes get lock problems at one of our customers. We found out, that the system tables sysprocplan and sysdistrib where locked by a... -
Trying to get smart quotes or "curly" quotes
I've searched forums and help to no avail. How do I ensure that the quote marks I get displayed are smart quotes, in other words the curly kind... -
Can "Computed Column" be a stored procedure in SQL Server 2000?
I am looking forward suggestions and solutions. I have a table and would like to add a "computed column" for reporting performance reason. The... -
TA-Selene #2
Re: SQL Stored Procedure Problem "Single Quotes"
You just need to wrap the entire variable (including your single quotes) in the
PreserveSingleQuotes function. Basically, you need to double up your quotes
when apssing so they will be escaped. This function does it for you.
TA-Selene Guest
-
tranzformerz #3
Re: SQL Stored Procedure Problem "Single Quotes"
Another way of looking at the Select Statement is:
SQL Stored Procedure:
declare @var int
set @var = '1','2'
select *
from tbl_table
where forum_id IN (@var)
Just by looking at it, when setting @var to '1','2' you will get an error. I
hope this helps in getting a better perspective on this.
Thanks again....
tranzformerz Guest
-
tranzformerz #4
Re: SQL Stored Procedure Problem "Single Quotes"
TA-Selene thanks! I will give this a try and will post back my findings.
tranzformerz Guest
-
tranzformerz #5
Re: SQL Stored Procedure Problem "Single Quotes"
PreserveSingleQuotes did not solve the problem, however good function to
consider when dealing with quotes. The problem was that this specific problem
didn't work when using a STOREDPROCEDURE. I just did a straight CFQUERY rather
than CFSTOREDPROC. There maybe other ways of approaching this, but this one
worked. Thanks TA-Selene for the effort. I greatly appreciate the promptly
response.
tranzformerz Guest



Reply With Quote

