Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @myTinyInt as TINYINT = 25;
- declare @myInt as INT = 666;
- select @myTinyInt + @myInt;
- declare @myChar as CHAR(6) = 'six';
- declare @myInt as INT = 1;
- select @myChar + @myInt;
- select empid, lastname
- from HR.Employees
- where lastname COLLATE Latin1_General_CS_AS = N'Funk'
- select empid, lastname, firstname + N' ' + lastname as fullname
- from HR.Employees
- select empid, lastname, CONCAT(firstname, N' ', lastname) as fullname
- from HR.Employees
- SELECT TOP(3) orderid, FORMAT(orderdate, 'd', 'en-us') as us,
- FORMAT(orderdate, 'd', 'de-DE') as de
- FROM Sales.Orders;
- SELECT SUBSTRING('Microsoft SQL Server', 11, 3);
- SELECT LEFT('Microsoft SQL Server', 9);
- SELECT LEN('Microsoft SQL Server ');
- SELECT DATALENGTH('Microsoft SQL Server ');
- SELECT CHARINDEX('SQL', 'Microsoft SQL Server');
- SELECT REPLACE('Microsoft DUPA Server', 'DUPA', 'SQL');
- SELECT UPPER('Microsoft SQL Server');
- SELECT LOWER('Microsoft SQL Server');
- SELECT orderdate, orderid
- FROM Sales.Orders
- WHERE orderdate = '20070825'
- declare @DateOnly as DATETIME ='20120225'
- SELECT @DateOnly;
- SELECT GETDATE(),
- CURRENT_TIMESTAMP,
- GETUTCDATE(),
- SYSDATETIME(),
- SYSUTCDATETIME(),
- SYSDATETIMEOFFSET();
- SELECT datename(year, '20120220')
- SELECT month('20120220')
- SELECT datediff(millisecond, GETDATE(), SYSDATETIME());
- SELECT DATEFROMPARTS(2012, 12, 31);
- SELECT DATETIMEFROMPARTS(2012, 12, 31, 8, 30, 0, 0);
- SELECT DATETIME2FROMPARTS(2012, 12, 31, 8, 30, 0, 0, 0);
- SELECT DATETIMEOFFSETFROMPARTS(2012, 12, 31, 8, 30, 0, 0, -7, 0, 0)
- SELECT ISDATE('20180202');
- SELECT ISDATE('20180231');
- SELECT CAST(1 as VARCHAR(10)) + 'abc';
- SELECT CAST('20120305' as date)
- SELECT CONVERT(DATE, '12/11/2018', 101);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement