-
Simple SQL Parameter problem
I tried to create the following stored procedure, but SQL syntax checker won't
accept it.
Any idea what's wrong? I believe it has something to do with "UPDATE @p1".
CREATE PROC sp_FixFaultyDate @p1 VARCHAR(30), @p2 VARCHAR(30)
AS
UPDATE @p1
SET @p2 = '2000'
WHERE @p2 LIKE '1900%'
Thanks, everybody.
-
Re: Simple SQL Parameter problem
Yes,
you have to put instead @p1 a table name. If you want to use
a parameter for table name you have to use EXEC
grig petrescu
"Eric" <ericb@tfillc.com> wrote:
>
>I tried to create the following stored procedure, but SQL syntax checker
won't
>accept it.
>
>Any idea what's wrong? I believe it has something to do with "UPDATE @p1".
>
>
>CREATE PROC sp_FixFaultyDate @p1 VARCHAR(30), @p2 VARCHAR(30)
>AS
>
>UPDATE @p1
>SET @p2 = '2000'
>WHERE @p2 LIKE '1900%'
>
>
>Thanks, everybody.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks