I'm inserting lots of rows into a database and some of the columns are blank for some of the rows.
How can I insert without assigning a dummy value to these blank fields?
1 INSERT Leads VALUES('name', 'cityName', 5, 'anotherValue')
2 INSERT Leads VALUES('name', 'cityName', , 'anotherValue')
3 INSERT Leads VALUES('name', 'cityName', 2, 'anotherValue')
4 INSERT Leads VALUES('name', 'cityName', 9, 'anotherValue')
My problem lies in row 2 where there is a blank value in between city name and another value. Ideally, I'd like the value to remain null.
Any help is appreciated.
Thanks!
You should always explicitly specify which columns you're inserting to - then you can leave out those you don't want:
INSERT INTO dbo.Leads(Col1, Col2, Col4) VALUES('name', 'cityName', 'anotherValue')
(leaving out Col3
here in this example)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With