SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 declaring a parameter as null
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

marclas
Starting Member

Camaroon
16 Posts

Posted - 05/08/2012 :  06:23:24  Show Profile  Reply with Quote
HI

how can i set a null value when declaring a parameter
example
[code="sql"]
CREATE PROCEDURE dbo.GestionStatutDossier
-- Add the parameters for the stored procedure here
@StaId int NULL,
@DosID uniqueidentifier,
@staDate datetime,
@staBL nvarchar (50),
@staCRprod nvarchar (50)
AS
[/code]


Marclas

Transact Charlie
Flowing Fount of Yak Knowledge

United Kingdom
3425 Posts

Posted - 05/08/2012 :  06:31:33  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
use =

Here you can see some default values for the parameters.


BEGIN TRANSACTION
GO

CREATE PROCEDURE dbo.GestionStatutDossier
-- Add the parameters for the stored procedure here
@StaId int = NULL,
@DosID uniqueidentifier,
@staDate datetime = '20120101',
@staBL nvarchar (50) = 'FOO',
@staCRprod nvarchar (50) = NULL
AS BEGIN
	SELECT
		@StaId
		, @DosID
		, @staDate
		, @staBL
		, @staCRprod
END
GO

DECLARE @dosID UNIQUEIDENTIFIER = NEWID()
EXEC dbo.GestionStatutDossier @DosID = @dosID
GO

ROLLBACK TRANSACTION


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

marclas
Starting Member

Camaroon
16 Posts

Posted - 05/08/2012 :  06:59:56  Show Profile  Reply with Quote
Merci

Marclas
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000