Issue with NULL behaviour in CHARINDEX?

select LEFT(null,CHARINDEX(‘.’,NULL))

You would expect it to work and return NULL right?
I’ve seen it not working on some servers. These servers are mostly 64 bits (meaning it’s easier to reproduce it on 64 bits) but it gets reproduced on 32 sometimes. You might even encounter the situation where it will work for an indefinte runs and all of a sudden crash.

I have posted it on some sql server forums but nobody can give a valid explanation. And going to Microsoft with it is not always easy 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: