January 15, 2013 at 11:25 am
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)
January 15, 2013 at 11:40 am
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
January 15, 2013 at 11:43 am
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
January 15, 2013 at 11:48 am
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