J.E.Y
J.E.Y

Reputation: 1175

T-SQL syntax: is "LIKE '%'" legitimate?

I could have experimented this had I access to a SQL Server instance or other SQL database.

Anyway I came across this SQL server stored procedure, in which there is a factually statement like:

some_field LIKE '%'

I think this is a legitimate statement but what will it return? My take is no matter what the value of some_field is, it always returns TRUE.

Upvotes: 2

Views: 86

Answers (1)

some_field LIKE '%'

Will return all values except null. It's the same as:

some_field IS NOT NULL

Upvotes: 3

Related Questions