Simple SQL Parameter problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Simple SQL Parameter problem

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.



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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center