DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Eric Guest

    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.

  2. #2
    grig petrescu Guest

    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.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links