Some thing funny in SQL ... :Wow:

  • Hi frd's,

    When i am doing my work today i found some thing funny in sql.... by mistake in where condition i ahve given '-' and i Executed successfully and shoen the result of all tables

    Now what i want to know is how it accepts '-' as column name...I want to know how itz working

    select * from t_country_shops

    where '-' like '_' :hehe:

    _______________________________________________________________

    Need help? Help us help you.

  • No surprises: it's all documented behaviour.

    You can use any expression as a left or right side of the LIKE operator. Any expression includes a constant, such as '-'.

    -- Gianluca Sartori

  • Hello

    _ (underscore) means any single character. So '-' like '_' always true

    for ref: http://msdn.microsoft.com/en-us/library/ms179859.aspx

    Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply