﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / How to get the system date automatically in the columns / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 16:41:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to get the system date automatically in the columns</title><link>http://www.sqlservercentral.com/Forums/Topic1382282-391-1.aspx</link><description>Have you tried adding default values on the fields within the database?You sometimes have to set the fields to "Allow NULLs" if the data isn't contained within the set you're trying to import.But just set a string value of "system" against the user field and the getdate() variable against the date field, as defaults and they should populate automatically with the imported dataset.</description><pubDate>Thu, 08 Nov 2012 03:54:29 GMT</pubDate><dc:creator>McSQL</dc:creator></item><item><title>RE: How to get the system date automatically in the columns</title><link>http://www.sqlservercentral.com/Forums/Topic1382282-391-1.aspx</link><description>Have you considered using [url=http://msdn.microsoft.com/en-us/library/ms175915.aspx]INSERT ... SELECT * FROM OPENROWSET(BULK[/url] instead of BULK INSERT?you can specify the columns to be inserted to with this command.e.g.[code="sql"]INSERT testAll.[dbo].[branch](branch_code, branch_name, branch_desc)SELECT * FROM OPENROWSET(BULK 'C:\myBranches.dat', SINGLE_BLOB) a[/code]</description><pubDate>Thu, 08 Nov 2012 00:45:42 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>RE: How to get the system date automatically in the columns</title><link>http://www.sqlservercentral.com/Forums/Topic1382282-391-1.aspx</link><description>Yes I tried...but that is not working. I'm getting the same errorGMBAR,BARBIL,ODISHA REGIONGMBBS,BHUBANESWAR,ODISHA REGIONGMBEL,BELLARY,SOUTH REGIONGMBHU,BHUJ,GUJARATGMKND,KANDLA(SEZ),GUJARAT (SPECIAL ECONOMIC ZONE)GMHYD,HYDERABAD,SOUTH REGIONGMKOD,KODURU,SOUTH REGIONGMKOL,KOLKATA,EAST REGIONGMMGG,MANDIGOBINDGARAH,NORTH REGIONThis is my branch data which is a .csv file which i have to load it using bulkinsert.The last 2 fields should be given as 'system' and GETDATE()</description><pubDate>Thu, 08 Nov 2012 00:07:32 GMT</pubDate><dc:creator>arthi.anan</dc:creator></item><item><title>RE: How to get the system date automatically in the columns</title><link>http://www.sqlservercentral.com/Forums/Topic1382282-391-1.aspx</link><description>Have you tried binding default constraints to the columns, e.g.[code="sql"]ALTER TABLE [dbo].[branch] ADD  CONSTRAINT [df_mod_by]  DEFAULT (suser_sname()) FOR [modified_by]GOALTER TABLE [dbo].[branch] ADD  CONSTRAINT [df_mod_date]  DEFAULT (sysdatetime()) FOR [modified_date]GO[/code]</description><pubDate>Thu, 08 Nov 2012 00:01:29 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>How to get the system date automatically in the columns</title><link>http://www.sqlservercentral.com/Forums/Topic1382282-391-1.aspx</link><description>Hi experts,I have a table called branch with columnsbranch_codebranch_namebranch_descmodified_bymodified_dateHere i have data for the 1st three columns and the rest 2 fields 'modified_by' and 'modified_date' has to get values automatically from the system...I did a bulk insert to get the data into those 3 columns but it is expecting 'modified_by' and 'modified_date' fields.How do i give it separately? the values in those last 2 fields should be given as 'system' and GETDATE()Please help me with ur scripts</description><pubDate>Wed, 07 Nov 2012 23:56:32 GMT</pubDate><dc:creator>arthi.anan</dc:creator></item></channel></rss>