How about providing the calling code?
-Mike
>I have a problem where my sp always returns null value.
>
>The sp code is:
>ALTER PROCEDURE getKeyField
> @tableRef NVARCHAR(128),
> @keyField NVARCHAR(128) = NULL OUTPUT
>AS
>
>SET NOCOUNT ON
>
>SELECT @keyField = constraint_name FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS (NOLOCK) WHERE TABLE_NAME = @tableRef AND CONSTRAINT_TYPE = 'PRIMARY KEY'
>
>
>*******************
>
>The sp works ok if it is executed in Query Analyser, but it always returns null when I called it from asp.net
>
>The output parameter always return null.
>
>Any Idea?
>
>Thanks,
>Eka