Skip to content

SNOW-1917621: Cannot pass null into a stored procedure to nullable DATE field #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VelvetAndrea opened this issue Feb 7, 2025 · 1 comment
Labels

Comments

@VelvetAndrea
Copy link
Contributor

  1. What version of .NET driver are you using?
    4.01

  2. What operating system and processor architecture are you using?
    Windows 11, Azure windows latest

  3. What version of .NET framework are you using?
    .NET 8 in-process

  4. What did you do?
    I have a stored procedure that accepts 2 variables, the first is a guid, the second is a date, the third is a string.

Parameters are added like this:

SqlParameter[] sqlParameters = [ new SqlParameter("MYGUID", pumpRequest.BatchUid), new SqlParameter("MYDATE", pumpRequest.LookBackDate), new SqlParameter("MYSTRING", pumpRequest.StateAbbrev) ];

In this case, MYGUID contains a Guid and MYDATE and MYSTRING are null

But even though the DATE is null, it appears that the code tries to convert the value to an int and I'm getting the following error:

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Snowflake.Data StackTrace: at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List1 parameters)
`

Image

  1. What did you expect to see?

The stored procedure, would receive the null DATE field and query would execute as expected.

It appears that it needs a null check before going into this code block.

  1. Can you set logging to DEBUG and collect the logs?

I can, but I'm not going to post this on a public website.

@github-actions github-actions bot changed the title Cannot pass null into a stored procedure to nullable DATE field SNOW-1917621: Cannot pass null into a stored procedure to nullable DATE field Feb 7, 2025
@sfc-gh-dszmolka
Copy link
Contributor

seems to be dupe of #1095

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants