Dhwani Dhwani - 1 year ago 100
SQL Question

Default value V/s passing value in INSERT statement

I am using MSSQL SERVER. The questions I am asking might be silly but I want some valid answers. So here is my question:

I have a table with some columns. I have taken default in some column like

0 (for INT column)
GETDATE() (for DATE column)
. Now one of my colleague said that taking
as default will increase overhead so better to pass datetime by INSERT statement. Is it true?

Is it not applicable to 0 or 1 (for INT column)?
How does it create overhead?

Answer Source

int default 0 or 1 is a value like hardcode.

but, getdate () like function to know the date on the computer server of SQL Server.

so, when the insert statement, the column with the default getdate () will look for the value prior to the server computer before the command insert is run.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download