Posts

Stored Procedure

 To Create : WithOut Params: CREATE PROCEDURE <stored procedure name> AS BEGIN <Query/Logic> END; With Params: CREATE PROCEDURE <stored procedure name> (      @prameter1 name  datatype,      @prameter2 name datatype, ) AS BEGIN <Query/Logic> END; To Declare: Same as Create but in the place of Create line put DECLARE and remove AS  DECLARE (      @prameter1 name  datatype = value,      @prameter2 name datatype = value, ) BEGIN <Query/Logic> END; To Update/Modify: Same as Create but in the place of Create line put Modify To view: sp_helptext <stored procedure name> To Exec: WithOut Params EXEC <stored procedure name> With Params EXEC <stored procedure name> @prameter1 name = value, @prameter2 name = value

Other Functions

 App_Name() Cast() Coalesce() Collationproperty() Columns_Updated() Convert() Current User Datalength() @@Error fn_Helpcollations() fn_lndexinfo() :.fn Servershareddrives :.fn Virtualservernodes Formatmessage() Getansinull() Host_ld() Host_Name() Ident_Current() Ident_lncr() Ident_Seed() @@ldentity Identity() (Select Into) Isnull() Isnumeric() Newid() Nullif() Parsename() Permissions() @@Rowcount Rowcount_Big() Scope_ldentity() Serverproperty() Sessionproperty() Session_User Stats_Date() System_lJser @@Trancount Update() User_Name()

Mathematical Functions

 Abs() Acos() Asin() Atan() Atn2() Ceiling() Cos() Cot() Degrees() Exp() Floor() Log() Log10() Power() Radians() Rand() Round() Sign() Sin() Sqrt() Square() Tan()

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()