nicholas van
nick at frasiervan.com
Wed Jun 8 13:07:42 CDT 2005
Will using a default value work? CREATE PROCEDURE [genesis_select_ClientDetails] @strACNo [nvarchar](20) = '000001' It should set teh @strACNo to '000001' when the input is Null. ---------- Original Message ---------------------------------- From: "Paul Hartland" <Paul.Hartland at orridge.co.uk> Reply-To: dba-sqlserver at databaseadvisors.com Date: Tue, 7 Jun 2005 16:06:50 +0100 >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..... > > >PAUL HARTLAND >Database Designer/Programmer >paul.hartland at isharp.co.uk >Mobile - (+44)7730 523179 > > >