I have an CR 10 report with a command hitting a SQL server 2000 database.
Command has a parameter that prompts the user for an activity name
The value can come in with single quotes. i.e. for parameter called ACITIVTY the value would be : Jim's game
Since Command basically posts the "value" in the SQL ( aka "not by reference") I have no chance to run replace on it before the sql run's so it error's on having single quotes in the value.
I originally had the Parameter in the where clause. Have tried to capture it using a variable but to no avail.
Help is greatly appreciated
DECLARE @MyCharVar CHAR(100)
SET @MyCharVar = Replace('{?Activity}','''','''''')
SELECT
tablename.column1
,tablename column2
...
FROM dbo.tablename
...
WHERE dbo.tablename.column1 = @MyCharVar
Kevin McManus
kevin@mcmanusconsulting.com
Command has a parameter that prompts the user for an activity name
The value can come in with single quotes. i.e. for parameter called ACITIVTY the value would be : Jim's game
Since Command basically posts the "value" in the SQL ( aka "not by reference") I have no chance to run replace on it before the sql run's so it error's on having single quotes in the value.
I originally had the Parameter in the where clause. Have tried to capture it using a variable but to no avail.
Help is greatly appreciated
DECLARE @MyCharVar CHAR(100)
SET @MyCharVar = Replace('{?Activity}','''','''''')
SELECT
tablename.column1
,tablename column2
...
FROM dbo.tablename
...
WHERE dbo.tablename.column1 = @MyCharVar
Kevin McManus
kevin@mcmanusconsulting.com