Getting field value from notepad

  • Hi Everybody,

    I have table with two columns,join_date and empno.I saved the join_date value inside the notepad and saved it in C:\join_date.txt

    I'm trying to write a sql statement that will fetch the value from notepad while executing the update statement

    update emp_table set join_date=(file_name) where empno='890'

    WHat should I put in place of file name.

    or is there another way to do this.

    Pls help

    (The notepad has only one single date value)

  • What are you trying to accomplish?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • You can use OPENROWSET() to open the file. I have a script in the code library section of my blog[/url] for using this function.

    However, like Jason asked, what is the business purpose for doing this? Why does it need to be in a file?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • If join date is the date someone joined a group, then just populate it when you first insert your row. If you want it handled by the database for you, you can create the column as NOT NULL DEFAULT GetDate(), but I would be very hesitant about updating tables with data from text files unless the content of the text files is very tightly controlled.

    There must be something that's not being said here for the purpose of having the data in a text file in the first place.

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

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