Why can't I execute this script in ADO?

From: Petar Petrovic (mojne_at_uznemiravati.me)
Date: 01/23/04

  • Next message: tony: "Error on ClientDataSet"
    Date: Fri, 23 Jan 2004 08:26:01 +0100
    
    

    I've tried to execute following script in ADOCommand but unsuccsessfully :-(

    --------- SCRIPT BEGIN ----------

    if exists ( select 1
                from sysobjects
                where name = 'prProc1'
                and type = 'P')
       drop procedure prProc1
    go

    create procedure prProc1
    (
      @CategoryID int
    )
    as
      if ( @CategoryID = -1 )
      begin
        select
          CategoryID,
          CategoryName,
          Description,
          Picture
        from
          "Categories"
      end
      else
      begin
        select
          CategoryID,
          CategoryName,
          Description,
          Picture
        from
          "Categories"
        where
          CategoryID = @CategoryID
      end
    go

    if exists ( select 1
                from sysobjects
                where name = 'prProc2'
                and type = 'P')
       drop procedure prProc2
    go

    create procedure prProc2
    (
      @CategoryName nvarchar(15),
      @Description ntext,
      @Picture image
    )
    as
      insert into "Categories"( CategoryName, Description, Picture )
      values( @CategoryName, @Description, @Picture )
    go

    --------- SCRIPT END ----------

    Then I removed 'GO' from the script but I received an error that "CREATE
    PROCEDURE must be first statement".
    Is there a way to execute such things in Delphi applications anyway?

    Thanks and regards!


  • Next message: tony: "Error on ClientDataSet"