Skip to content

Tag: sql-server

How to add a column in MSSQL with default value?

In MSSQL 2014 I would like to use an update syntax which is adding a new column with a default value. Is this possible somehow? Answer Here is a complete reproducible example. Create table Check contents Add new column with default value Check the result Here is a SQL fiddle with this example.

Send mail every N days in SQL

I need to send a warning mail 14 days before certificates valid_to date ends and also send email every 3 days from delay_days. Table Certificates consists of: ID(int) | cert_valid_to(date) | …

SQL BCP Unable to insert value for identity column

I am using bcp utility to import a tab delimited file. My table has an identity column, when I run bcp command I get error as Error = [Microsoft][SQL Server Native Client 11.0] Invalid date format Second column is datetime. When i use -E flag (as suggested by many), I get error as Error = [Microsoft][SQL Serv…