@manhng

Welcome to my blog!

MS SQL Server Installation Guide

October 21, 2020 13:48

MS SQL Server Installation Guide (edit)

For SQL Server 2019 Express Edition in Windows Server 2019

  • Configure: Allow remote connections to this server
  • Configure: SQL Server Configuration Manager > Protocols for MSSQLSERVER > TCP/IP (Enabled) > TCP/IP Properties > IP Addresses tab
    • IP Address: 10.10.10.10 (Enter the Public IP Address)
    • TCP Port: 1433
  • Configure: Windows Defender Firewall with Advanced Security > Inbound Rules > New Rule... > Port:
    • TCP (selected)
    • Specific local ports: 1433 (enter)
    • Allow the connection (selected)
    • Domain, Public, Private (checked)
    • Name: SQL SERVER 1433 (enter)

Create Login

USE [master]
GO
CREATE LOGIN [test_user] WITH PASSWORD=N'Abc@123', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
GO
USE [test_db]
GO
CREATE USER [test_user] FOR LOGIN [test_user]
GO
USE [test_db]
GO
ALTER ROLE [db_owner] ADD MEMBER [test_user]
GO

MS Sql Server 2017

June 29, 2018 13:09

MS Sql Server 2017 (edit)

Format DateTime & Number

https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql?view=sql-server-2017

DECLARE @d DATETIME = GETDATE();

SELECT FORMAT( @d, 'dd/MM/yyyy', 'en-US' ) AS 'DateTime Result'FORMAT(123456789,'###,###') AS 'Custom Number Result';

Categories

Recent posts