How to get the system date automatically in the columns

  • 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

  • This was removed by the editor as SPAM

  • Yes I tried...but that is not working. I'm getting the same error

    GMBAR,BARBIL,ODISHA REGION

    GMBBS,BHUBANESWAR,ODISHA REGION

    GMBEL,BELLARY,SOUTH REGION

    GMBHU,BHUJ,GUJARAT

    GMKND,KANDLA(SEZ),GUJARAT (SPECIAL ECONOMIC ZONE)

    GMHYD,HYDERABAD,SOUTH REGION

    GMKOD,KODURU,SOUTH REGION

    GMKOL,KOLKATA,EAST REGION

    GMMGG,MANDIGOBINDGARAH,NORTH REGION

    This 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()

  • This was removed by the editor as SPAM

  • 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.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply