Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return Stored Proc Parameters
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01406967
Message ID:
01407055
Vues:
27
Something's wrong with the join to systypes, without it it works:
declare @ProcID int
Select @ProcID = OBJECT_ID from  sys.procedures P where p.Name = 'ap_NewWarehouse'

SELECT syscolumns.Name AS ParamName, systypes.Name as DataType, syscolumns.length 
	FROM syscolumns INNER JOIN systypes ON syscolumns.xtype = systypes.type where 
	SysColumns.ID = @ProcID
	Order by syscolumns.Name
	
select @ProcID
select * from syscolumns where id = @ProcID	
>>>I want to try to find out of a parameter can accept nulls. The syscolumns has an IsNullable column, but it's always 1. Know of any way to determine if a parameter for a proc can accept a null value?
>>
>>I suspect there is no simple way to determine if the parameter can accept NULL or not. I believe by default all parameters are NULL or usually I put
>>
>>@MyParam = NULL,
>>...
>>
>>in parameters definition.
>>
>>Just in case I asked your question on another board.
>
>
>Thanks. I think I found a problem with this query tho...
>
>Here's a stored proc:
>
>
>CREATE PROCEDURE ap_NewWarehouse
>	@WarehouseCode	VARCHAR(3) = NULL,
>	@Caption		VARCHAR(40) = NULL,
>	@Description	TEXT = NULL,
>	@WarehouseId	INT OUTPUT
>
>AS
>	INSERT INTO Warehouses
>		(WarehouseCode, Caption, Description, ForceInv)
>		VALUES
>		(@WarehouseCode, @Caption, @Description, 1)
>
>	SET @WarehouseId = SCOPE_IDENTITY()
>
>< /pre>
>
>Here's the query you posted for me:
>
>
><pre>
>SELECT syscolumns.Name AS ParamName, systypes.Name as DataType, syscolumns.length 
>	FROM syscolumns INNER JOIN systypes ON syscolumns.xtype = systypes.type 
>	INNER JOIN sys.procedures P on SysColumns.ID = P.Object_ID
>	where p.Name = 'ap_NewWarehouse'
>	order by syscolumns.Name
>
>
>And here's the results:
>
>
>ParamName        DataType        Length
>----------------------------------------------------------
>@Description      text                 16
>@Description      ntext               16
> @WarehouseId  int                   4
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform