I try to insert a row in a table which has date fields.I use Convert function like this:
CONVERT(DATETIME,'" & dateString & "',103).
The problem is that dateString variable may has an empty string-if the user don't choose a date. In that case I get in the DataBase the date :01/01/1900 .
I want that when the dateString is empty I'll get Null in that field on the Data Base and when the variable is not empty in the db will be the date in the variable.
In Oracle there is a function that does it - DCODE() function.
I need the same function but in Sql Server.