[dba-SQLServer]More SQL Server 7 Stored Procedure help if possible

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Feb 27 03:06:18 CST 2003


lol, thanks but I am using a test server. Thanks again for the help...........

From: "Francisco H Tapia" <my.lists at verizon.net>
Date: Wed 26/Feb/2003 17:18 GMT
To: <dba-sqlserver at databaseadvisors.com>
Subject: Re: [dba-SQLServer]More SQL Server 7 Stored Procedure help if possible

: Anyone have any idea how to do this within one Stored Procedure (or is it
possible in a single Stored Procedure.....???
Yes ;o)

: I would be grateful fr any sample code etc...
awright, but only cuz you'd be grateful ;o), [Wednesday... and I need my SOF
(soldier of fortune II) kick.]
I'm going to ASSuME that the payroll is the identity key for this table, or
the identifying key for this table...

CREATE PROCEDURE stp_UpdateAvailability (@PayrollNo as Int) AS
UPDATE tblAvailabilityAll
    SET Availability Code = CASE AvailabilityCode
                                            WHEN A THEN 1
                                            WHEN N THEN 2
                                            WHEN S THEN 3
                                            WHEN H THEN 4
                                        ELSE AvailabilityCode --othewise
just leave as is.
FROM tblAvailabilityAll
Where PayrollNo = @PayrollNo AND IsNumeric(AvailabilityCode) = 0

You mentioned that you are a novice.... and perhaps you know this.. but I'll
say it anyway...
**NEVER RUN TEST PROCEDURES ON A PRODUCTION SERVER!!!, ALWAYS USE A TEST
SERVER**
the license for a developer copy of Sql is about $500 so you can install SQL
Server on your desktop, this will help you out a lot in that you can
practice your backup/restore procedures and double-check your backups.
-Francisco
http://rcm.netfirms.com
----- Original Message -----
From: <paul.hartland at fsmail.net>
To: <dba-SQLServer at databaseadvisors.com>; <accessd at databaseadvisors.com>;
<dba-vb at databaseadvisors.com>
Sent: Wednesday, February 26, 2003 8:47 AM
Subject: [dba-SQLServer]More SQL Server 7 Stored Procedure help if possible


: To all,
:
: If you read my first email regarding Stored Procedure's you will know that
I am quite a novice at the moment.  I have a table called tblAvailabilityAll
which contains fields PayrollNo and an AvailabilityCode.  The Availability
codes are A,N,S,H and when an employee leaves, in the first instance we need
to update A,N,S,H to 1,2,3,4 accordingly.
:
: Anyone have any idea how to do this within one Stored Procedure (or is it
possible in a single Stored Procedure.....???
:
: I would be grateful fr any sample code etc...
:
: Thanks in advance
:
: Paul Hartland


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


__________________________________________________________________________
Freeserve AnyTime - Go online whenever you want for just £6.99 a month for
your first 3 months, that's HALF PRICE! And then it's just £13.99 a month
after that.

For more information visit http://www.freeserve.com/time/ or call free on 
0800 970 8890





More information about the dba-SQLServer mailing list