Posts

Showing posts from October, 2014

GetDate() Format

-- ## current date with time is yyyy-mm-dd hh:mm:ss SELECT GETDATE() -- ## current date without time is yyyymmdd SELECT CONVERT(CHAR(8), GETDATE(), 112)  -- ## current date without time is yyyy-MM-dd SELECT CONVERT(CHAR(10), GETDATE(), 126)

Change State SQL Express to Server

Image
Compatible :: Microsoft SQL Express 2005 and 2008 Install MS SQL Express 2008  SQL Query Command -- ## Change login mode to 2 = "Windows and SQL Server Authentication", 1 = "Windows Authentication Only" EXEC master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2 -- ## Enable sa and change password to "aaaa" ALTER LOGIN [sa] WITH PASSWORD='aaaa', CHECK_POLICY=OFF ALTER LOGIN [sa] ENABLE -- ## Change Port to 1433 EXEC master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\IpAll', N'TcpDynamicPorts', REG_DWORD, 1433 -- ## Enable Network TCP/IP and Change Port Run Command Prompt netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = SUBNET profile = CURRENT net stop "SQL Server (SQLEXPRESS)&qu

IP Class C (Subnet)

 การแบ่งเลข IP ในคลาส C ออกเป็นเน็ตเวิร์คย่อย (SubNet)    ควรจะมีความรู้ในระบบเลขฐานสอง (ฺBinary Numbers) ประกอบความเข้าใจ   ตัวเลขฐานสอง จำนวน 4 Byte ตัวเลขทั้งหมด 32 ตัว โดยมีเลข 1 อยู่  24  ตัว เราเลยเรียกเน็ตเวิร์คนั้นเป็น 192.168.1. 0  /  24 11111111 11111111 11111111 00000000 255 255 255 0 เลขฐาน 10 จำนวน 4 ชุด . ตัวเลขใน ชุดที่ 4 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 ค่าประจำ Bit 128 64 32 16 8 4 2 1 . เลขเน็ตเวิร์ค Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 ค่ารวม จำนวนเน็ตเวิร์คย่อยที่ แบ่งได้ใน 1 คลาส C จำนวนเครื่องที่มีได้ ในหนึ่งเน็ตเวิร์คย่อย 192.168.1.0 / 24 0 0 0 0 0 0 0 0 0 1 เน็ตเวิร์ค 254 (256) 192.168.1.0 / 25 1 0 0 0 0 0 0 0 128 2 เน็ตเวิร์ค 126 (128) 192.168.1.0 / 26 1 1 0 0 0 0 0 0 192 4 เน็ตเวิร์ค 62 (64) 192.168.1.0 / 27 1 1 1 0 0 0 0 0 22