So you are saying I could do this then....

<cfquery name="sp_Adduser" datasource="datasource">
        IF not EXISTS (SELECT * FROM sysobjects WHERE name =
"sp_Adduser1" AND type = "P")
        CREATE PROCEDURE sp_AddUser
         @username varchar(50),
         @password varchar(12),
         @Firstname varchar(50),
         @Familyname varchar(50),
         @ID varchar(50),
         @ID_Member varchar(50) output
        AS
         set nocount on
         if not exists (select ID_Member from Members where Username =
@username)
          begin
           insert into
Members(ID_Member,Username,Password,Firstname,Familyname)
           values (@ID,@username,@password,@Firstname,@Familyname)
           select @ID_Member = @ID
          end
         else
          select @ID_Member = -1
         return
        END
</cfquery>


> -----Original Message-----
> From: Andy Ewings [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 16 July 2001 9:37 PM
> To: CF-Talk
> Subject: RE: Stored Procedures
>
> yup
>
> In theory you can run any SQL statement in CF.  you can run multiple
> statements by separating them with a semi colon.
>
> to test if an SP exists the SQL code is:
>
> IF EXISTS (SELECT * FROM sysobjects WHERE name = "<spname>" AND type =
"P")
>     BEGIN
>       -- do whatever here
> ELSE
>     BEGIN
>       -- Create sp here
>     END
>
>
>
> -----Original Message-----
> From: Andrew Scott [mailto:[EMAIL PROTECTED]]
> Sent: 16 July 2001 12:32
> To: CF-Talk
> Subject: Stored Procedures
>
>
> I know I have asked this question before and it was answered here,
> however I have lost the code so I wish to ask again.
>
> I am playing around with storedprocs, what I am trying to do is
automate
> whether there is a way to see if a storedproc exists... If not then be
> able to create the storedproc via cfml...
>
> Regards
> Andrew Scott
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to