Saturday 19 July 2014

How to insert blank values in to a SQL Table

I have a table with ID, Name and Location
How to insert blank value in Location
Insert into <Table> values (2,'My Name','')
Above one will insert in blank
How to select blank value rows
Select * from <Table> where Location=''
How to insert null value in the table
Insert into <Table> values (2,'My Name')
Table is having 3 columns but we have inserted 2 columns so 3 rd column will be NULL
Select NULL records
Select * from <Table> where Location is null-- is correct
Select * from <Table> where Location= null --Is worng