I want to insert new records into a SQL server 2008 database. Some of the column values are NULL and so I get an error. This is the SQL query i am using:
INSERT INTO Products VALUES(NEWID(), '" + cur.name + "', '" + cur.type + "');
The error is caused if my values are NULL because it reads: NEWID(), , ;
I could do a bunch of if statements, but there MUST be a more efficient way to do it. Many thanks in advance.