Posts

Showing posts from August, 2024

DateTime Functions

 GETDATE() DATEADD() DATEDIFF() DATEPART() Datename() NOW() CURRENTDATE() CURRENTTIME() DATE() EXTRACT() CONVERT() FORMAT() Day() Month() Year() Sysdatetime() Sysdatetimeoffset() Sysutcdatetime() Gettutdate() Switchoffset() Todatetimeoffset() CurrentTimeStamp()

Sql Query Execution Order

 From  Join Where Group By Having  Select  Order By  Limit

Inbuilt functions

 Cast ToString() GetRoot() GetDescendant() IsDescendantOf() GetLeveI() GetAncestor() GetReparentedValue() RANK() DENSE_RANK() ROUND() Rownumber CTE Temperory Table patindex() Textptr() Textvalid()

Important queries

 To check database locks To execute stored procedure  To view stored procedure  To execute insert command with ids To execute query without locking 

String Functions

 SUBSTRING() LEFT() LEN() MID() LCASE() UCASE() Ascii() Char() Charindex() Difference() Left() Len() Lower() Ltrim() Nchar() Patindex() Quotename() Replace() Replicate() Reverse() Right() Rtrim() Soundex() Space() Str() String_Split() Stuff() Substring() Unicode() Upper() Trimo ConcatWs()

Constraints

 Primary key  Foreign key Not Null Default  Check  Unique  Index

How to take scripts of Schema or Data