import HOST file into a table
-
I would like to import my HOST file into a DB Table and the periodically run a script to verify if all the entries are the same, changed, deleted, etc.
-
I would like to import my HOST file into a DB Table and the periodically run a script to verify if all the entries are the same, changed, deleted, etc.
solutionsville wrote:
I would like to import my HOST file into a DB Table and the periodically run a script to verify if all the entries are the same, changed, deleted, etc.
Good for you. Did you have a question that you wanted to ask?
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
-
solutionsville wrote:
I would like to import my HOST file into a DB Table and the periodically run a script to verify if all the entries are the same, changed, deleted, etc.
Good for you. Did you have a question that you wanted to ask?
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
Hello Paul. I guess I was kinda vauge... Mind is elsewhere. Funeral today. I want to write an SQL script that looks at the Windows HOSTS File and reads the IP / host name into two columns of a table. I next want to write a SQL Script that I can run as a job and validate the entries in the hosts file and if they have changed then modify the table data. I will also send a diff email to myself noting any changes(the email piece I have figured out). Thanks,
-
Hello Paul. I guess I was kinda vauge... Mind is elsewhere. Funeral today. I want to write an SQL script that looks at the Windows HOSTS File and reads the IP / host name into two columns of a table. I next want to write a SQL Script that I can run as a job and validate the entries in the hosts file and if they have changed then modify the table data. I will also send a diff email to myself noting any changes(the email piece I have figured out). Thanks,
solutionsville wrote:
I guess I was kinda vauge... Mind is elsewhere. Funeral today.
Sorry to hear that.
solutionsville wrote:
I want to write an SQL script that looks at the Windows HOSTS File and reads the IP / host name into two columns of a table.
You could write a small .NET program to read the contents of your HOSTS file into SQL Server. Use the
System.IO.File.ReadAllLines()
to load the contents of the file into an array. Then do some string manipulation to separate the IP address and host name for each entry. Then use ADO.NET to load the data into your database.solutionsville wrote:
I next want to write a SQL Script that I can run as a job and validate the entries in the hosts file and if they have changed then modify the table data.
You could achieve this by using SQL Server AGent to set up a job that runs periodically.
solutionsville wrote:
I will also send a diff email to myself noting any changes(the email piece I have figured out).
You can write code in T-SQL to send mail. Have a look at this article[^]. You could invoke this from your SQL Server Agent job. Hope this helps. -- modified at 10:12 Tuesday 27th November, 2007 I forgot to include the link to the email article. I've put it in now.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
-
solutionsville wrote:
I guess I was kinda vauge... Mind is elsewhere. Funeral today.
Sorry to hear that.
solutionsville wrote:
I want to write an SQL script that looks at the Windows HOSTS File and reads the IP / host name into two columns of a table.
You could write a small .NET program to read the contents of your HOSTS file into SQL Server. Use the
System.IO.File.ReadAllLines()
to load the contents of the file into an array. Then do some string manipulation to separate the IP address and host name for each entry. Then use ADO.NET to load the data into your database.solutionsville wrote:
I next want to write a SQL Script that I can run as a job and validate the entries in the hosts file and if they have changed then modify the table data.
You could achieve this by using SQL Server AGent to set up a job that runs periodically.
solutionsville wrote:
I will also send a diff email to myself noting any changes(the email piece I have figured out).
You can write code in T-SQL to send mail. Have a look at this article[^]. You could invoke this from your SQL Server Agent job. Hope this helps. -- modified at 10:12 Tuesday 27th November, 2007 I forgot to include the link to the email article. I've put it in now.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
Thanks Paul.