[dba-SQLServer] Stored Procedures - Checking If Parameter Contains A Value

Francisco Tapia fhtapia at gmail.com
Tue Jun 7 11:44:25 CDT 2005


Check BOL for the usage of ISNULL

On 6/7/05, Paul Hartland <Paul.Hartland at orridge.co.uk> wrote:
> To all,
> 
> I have done a little work with SQL Server stored procedures with
> parameters (very simple ones), i.e. I have a stored procedure that
> selects a client based on the user entering an Account Number:
> 
>         CREATE PROCEDURE [genesis_select_ClientDetails]
>                 @strACNo                [nvarchar](20)
> 
>         AS
> 
>         SELECT          *
> 
>         FROM            tblClient
> 
>         WHERE           JobNo           =       @strACNo
> 
>         GO
> 
> This works well enough, but what I want to do is put a simple check in
> there where if @strACNo IS NULL then I want @strACNo to equal the very
> first Account number in the Client table.  I could do the check via my
> Visual Basic FE, but was wondering if it is possible to incorporate it
> into the stored procedure above.
> 
> Thanks in advance for any help on this.....


-- 
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...



More information about the dba-SQLServer mailing list