I have a stored procedure in my msSQL 2000 DBase... but every time it takes a string that has a character such as ., !, %, $, @, or anything like that it spits me out this error.
Quote:
Line 1: Incorrect syntax near '.'.
Code:CREATE PROCEDURE sp_getTableWhere
@vTable nvarchar(50),
@vcharValue1 nvarchar(50),
@vcharValue2 nvarchar(50)
AS
--Declaring variable to store our query
Declare @sql nvarchar(500)
SET @sql = 'SELECT * FROM ' + @vTable + ' WHERE ' + @vcharValue1 + ' = ' + '''' + @vcharValue2 + ''''
EXEC(@sql)
return
GO
I initialy thought it was my nvarchar, since I had it set to varchar before but it looks like it has nothing to do with that. I'm extremly confused as to why this is happening. I searched everywhere and found no answer.
If you could give me a hand, a link, an idea, anything... im depsperate. PLEASE!!!!!!!!
-Alek
