Stored Procedure HELP!  
Author Message
JohnBlanding





PostPosted: Mon Jan 12 03:33:53 CST 2004 Top

SQL Server >> Stored Procedure HELP!

Hi

I have created a Transact SQL Statement that I would like to save as a
Stored Procedure. I need some tips on how to modify this statement to work
as a stored procedure





the Length of the Number Series

of the Number Series Field


the Number Series Field


Number Series (Includes the Prefix)



(Without the Prefix)




varchar(10)) -- Returns the Prefix and the Next Number
FROM NumberSeries

Any help appreciated. Sarah

SQL Server80  
 
 
SriSamp





PostPosted: Mon Jan 12 03:33:53 CST 2004 Top

SQL Server >> Stored Procedure HELP! Modifying this as a stored procedure is simple. You just need to decorate
this code with the procedure creation semantics. Here is one sample (I've
moved the variable creation towards the begining for clarity).

IF (OBJECT_ID ('procedureName') IS NOT NULL)
DROP PROCEDURE procedureName
GO
CREATE PROCEDURE procedureName AS
BEGIN



Portion

the Number Series Field

the Number Series (Includes the Prefix)

(Without the Prefix)




the Length of the Number Series of the Number Series Field







SELECT

VARCHAR(10)) -- Returns the Prefix and the Next Number
FROM
NumberSeries
END
GO

You need to decide if anything in this code is controlled as parameters that
you would like to change from your application. If so, you need to modify
the procedure to take in parameters and then use that parameter in the
procedure.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp


> Hi
>
> I have created a Transact SQL Statement that I would like to save as a
> Stored Procedure. I need some tips on how to modify this statement to
work
> as a stored procedure
>




> the Length of the Number Series

Portion
> of the Number Series Field


> the Number Series Field


the
> Number Series (Includes the Prefix)

NumberSeries


> (Without the Prefix)




> varchar(10)) -- Returns the Prefix and the Next Number
> FROM NumberSeries
>
> Any help appreciated. Sarah
>
>


 
 
Sarah





PostPosted: Mon Jan 12 03:51:10 CST 2004 Top

SQL Server >> Stored Procedure HELP! Thanks for the prompt response only I cannot execute the procedure.

I am typing the following

Use DBName
EXEC procedureName
GO

I receive a message to say it cannot find the procedure




> Modifying this as a stored procedure is simple. You just need to decorate
> this code with the procedure creation semantics. Here is one sample (I've
> moved the variable creation towards the begining for clarity).
>
> IF (OBJECT_ID ('procedureName') IS NOT NULL)
> DROP PROCEDURE procedureName
> GO
> CREATE PROCEDURE procedureName AS
> BEGIN



> Portion

of
> the Number Series Field

> the Number Series (Includes the Prefix)

Series
> (Without the Prefix)

>


> the Length of the Number Series of the Number Series Field



NumberSeries



>
> SELECT

> VARCHAR(10)) -- Returns the Prefix and the Next Number
> FROM
> NumberSeries
> END
> GO
>
> You need to decide if anything in this code is controlled as parameters
that
> you would like to change from your application. If so, you need to modify
> the procedure to take in parameters and then use that parameter in the
> procedure.
> --
> HTH,
> SriSamp
> Please reply to the whole group only!
> http://www32.brinkster.com/srisamp


> > Hi
> >
> > I have created a Transact SQL Statement that I would like to save as a
> > Stored Procedure. I need some tips on how to modify this statement to
> work
> > as a stored procedure
> >

Series


Field

Sets
> > the Length of the Number Series

> Portion
> > of the Number Series Field


of
> > the Number Series Field


> the
> > Number Series (Includes the Prefix)

> NumberSeries


Series
> > (Without the Prefix)




> > varchar(10)) -- Returns the Prefix and the Next Number
> > FROM NumberSeries
> >
> > Any help appreciated. Sarah
> >
> >
>
>


 
 
Sarah





PostPosted: Mon Jan 12 03:57:55 CST 2004 Top

SQL Server >> Stored Procedure HELP! Problem solved.. instead I typed exec db.dbo.procedure name and then it
worked



> Thanks for the prompt response only I cannot execute the procedure.
>
> I am typing the following
>
> Use DBName
> EXEC procedureName
> GO
>
> I receive a message to say it cannot find the procedure
>
>


> > Modifying this as a stored procedure is simple. You just need to
decorate
> > this code with the procedure creation semantics. Here is one sample
(I've
> > moved the variable creation towards the begining for clarity).
> >
> > IF (OBJECT_ID ('procedureName') IS NOT NULL)
> > DROP PROCEDURE procedureName
> > GO
> > CREATE PROCEDURE procedureName AS
> > BEGIN

Series

Field

> > Portion

> of
> > the Number Series Field

in
> > the Number Series (Includes the Prefix)

> Series
> > (Without the Prefix)

> >


Sets
> > the Length of the Number Series of the Number Series Field



> NumberSeries



> >
> > SELECT

> > VARCHAR(10)) -- Returns the Prefix and the Next Number
> > FROM
> > NumberSeries
> > END
> > GO
> >
> > You need to decide if anything in this code is controlled as parameters
> that
> > you would like to change from your application. If so, you need to
modify
> > the procedure to take in parameters and then use that parameter in the
> > procedure.
> > --
> > HTH,
> > SriSamp
> > Please reply to the whole group only!
> > http://www32.brinkster.com/srisamp


> > > Hi
> > >
> > > I have created a Transact SQL Statement that I would like to save as a
> > > Stored Procedure. I need some tips on how to modify this statement to
> > work
> > > as a stored procedure
> > >

> Series


> Field

> Sets
> > > the Length of the Number Series

> > Portion
> > > of the Number Series Field


Portion
> of
> > > the Number Series Field


in
> > the
> > > Number Series (Includes the Prefix)

> > NumberSeries


> Series
> > > (Without the Prefix)




> > > varchar(10)) -- Returns the Prefix and the Next Number
> > > FROM NumberSeries
> > >
> > > Any help appreciated. Sarah
> > >
> > >
> >
> >
>
>