SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to get system date automatically in the column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arthiasha
Starting Member

India
40 Posts

Posted - 11/08/2012 :  01:57:54  Show Profile  Reply with Quote

Hi experts,

I have a table called branch with columns
branch_code
branch_name
branch_desc
modified_by
modified_date

Here 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

bandi
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 11/08/2012 :  02:21:29  Show Profile  Reply with Quote
Have you designed your table with DEFAULT constraint?

Check this link (Keep Nulls or UseDefault Values During Bulk Import)
http://msdn.microsoft.com/en-us/library/ms187887.aspx

--
Chandu
Go to Top of Page

ahmeds08
Aged Yak Warrior

India
573 Posts

Posted - 11/08/2012 :  06:57:33  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
as bandi mentioned you need apply default values to the two columns.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000