Skip to main content

Posts

Showing posts with the label sample code

SQL Update From One Table To Another Based On A Id Match

I have an employees table and an EmployeeTerritories table. The employeeid in both these tables are in integer datatype.   I have to create a new unique identifier column in both these tables and then update them accordingly. 1. I created a newsequentialid column in the employees table that will create new ids for the employees 2. Next, i added a new column to the employee territories table and set it as a foreign key to the employees table 3. now, i am in need of a query that will fetch the new guid from the employee table and fill in the employee territories table 4. i need to have a single update statement that do the trick by making use of the existing numerical id values UPDATE EmployeeTerritories SET empid = Id FROM EmployeeTerritories INNER JOIN Employees ON Employees.EmployeeID = EmployeeTerritories.EmployeeID This update statement will update the empid in the territories table based on the id matching. This saves a lot of time in comparison to the manual match

HOW TO Use IIS Express From The Command Line

The following code snippet can be used to run the IIS Express [8.0] in my case to be run from the command line. The parameters are the path to the main directory, the target libraries [dll's] should be in a folder  called as “bin” inside this given path for the IIS to pick up and run. The other parameter is the “port” which specifies which port should IIS Express listen for the incoming request. It also logs in the requests and the response status etc in the command line. Sample : c:\Program Files\IIS Express>iisexpress.exe /path:”C:\Users\Saravanan\Documents\Visual Studio 2012\Projects\console_app_in_iis\console_app_in_iis” /port:8089