Procedure Parameters / Empty Strings

Last Post 15 Jun 2007 01:36 AM by mrledbet. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
New Member
New Member

15 Jun 2007 01:36 AM
Why do I receive these results (?) :

Jan 1 1900 12:00AM

For a procedure that is defined as this :

create procedure mark_test(@int1 as int,@date1 as datetime)
print @int1
print @date1

When I call it using these empty string parameters :

exec mark_test '',''

It appears that SQL Server converts empty strings to zero (0) for int parameters, and Jan 1 1900 for datetime parameters.

I've tried to Google this to understand why this happens, but haven't found anything yet. My Oracle DBAs are citing things like this and a bunch of other little idiosyncracies for reasons why we should use Oracle instead. Can anybody help ? Is this ANSI standard behavior ?

I know - we can easily work around this problem by checking parameter values before calling the proc (ISNUMERIC, ISDATE, etc.) .. but I would like to understand why this occurs.

Thanks, Mark
You are not authorized to post a reply.

Acceptable Use Policy