How do I fix ‘Invalid character value for cast specification’ on a date column in flat file?

I was ultimately able to resolve the solution by setting the column type in the flat file connection to be of type “database date [DT_DBDATE]” Apparently the differences between these date formats are as follow: DT_DATE A date structure that consists of year, month, day, and hour. DT_DBDATE A date structure that consists of year, … Read more

How can I get column names from a table in SQL Server?

You can obtain this information and much, much more by querying the Information Schema views. This sample query: Can be made over all these DB objects: CHECK_CONSTRAINTS COLUMN_DOMAIN_USAGE COLUMN_PRIVILEGES COLUMNS CONSTRAINT_COLUMN_USAGE CONSTRAINT_TABLE_USAGE DOMAIN_CONSTRAINTS DOMAINS KEY_COLUMN_USAGE PARAMETERS REFERENTIAL_CONSTRAINTS ROUTINES ROUTINE_COLUMNS SCHEMATA TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLES VIEW_COLUMN_USAGE VIEW_TABLE_USAGE VIEWS

SQL Server Insert if not exists

instead of below Code replace with Updated : (thanks to @Marc Durdin for pointing) Note that under high load, this will still sometimes fail, because a second connection can pass the IF NOT EXISTS test before the first connection executes the INSERT, i.e. a race condition. See stackoverflow.com/a/3791506/1836776 for a good answer on why even wrapping in a … Read more