Archive



Create and populate a simple calendar table in MS SQL

Edit as required…

USE master
go
 
IF  EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tCalendar')
BEGIN
DROP TABLE tCalendar
END
go
 
CREATE TABLE tCalendar (
DateID INT IDENTITY(1,1) CONSTRAINT tCalendar_PK PRIMARY KEY CLUSTERED,
DATE DATETIME,
Holiday BIT DEFAULT 0,
Workday BIT DEFAULT 0)
go
CREATE UNIQUE NONCLUSTERED INDEX
tCalendar_date_N_Idx ON tCalendar(DATE)
go
 
--Populate all days
 
DECLARE @n INT
DECLARE @maxn INT
DECLARE @begindate DATETIME
SET @n =1
SET @maxn=36500    -- Number of days added to the calendar
SET @begindate =CONVERT(DATETIME,'01/01/1995')
-- Initial date for the first run is todays date
-- or Jan 1st
SET @begindate =@begindate -1
 
WHILE @n <= @maxn
BEGIN
INSERT INTO tCalendar(DATE) SELECT @begindate+@n
SET @n=@n+1
END
 
--update the holiday and workday flags
 
go
UPDATE tCalendar
SET holiday=1 WHERE DATENAME(dw,DATE) in ('Saturday','Sunday')
go
UPDATE tCalendar
SET workday=1 WHERE holiday=0
go
 
SELECT * FROM tCalendar

Post Comment Now


Speed up Firefox

Make FF faster.

In the address bar… type “about:config”

Filter: network

Set network.http.pipelining = true

Set network.pipelining.maxrequests = 8


Post Comment Now


Change Remote Desktop Listening Port

Changing the listening port for Remote Desktop can have its advantages, particularly if you are remoting in from behind a firewall. Since a lot of public firewalls (hotels, airports, etc.) block most ports except for those used for email and internet access, using the default settings for Remote Desktop will not work on them. As long as you are not remoting into a machine that is serving secure sites, you can change the listening port to 443 and access your machine from almost anywhere. Just follow these instructions:1. Open Regedit.

2. Navigate to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

.

3. Find the dword value named PortNumber.

4. Change the value to 443.

5. Close Regedit and reboot.

To connect, open the remote client and type in the hostname or address followed by :443.


Post Comment Now


Blog | Contact | Gallery | Links | Sandbox | Social Networking | Weather | Web Design


Copyright © 1997-2009 KCSH. All rights reserved.