{"id":4391,"date":"2017-11-09T21:26:16","date_gmt":"2017-11-09T21:26:16","guid":{"rendered":"http:\/\/vivegroups.com\/?p=4391"},"modified":"2022-08-28T15:42:56","modified_gmt":"2022-08-28T15:42:56","slug":"sql-server-functions","status":"publish","type":"post","link":"https:\/\/iteducation.vivegroups.com\/sql-server-functions\/","title":{"rendered":"SQL Server Functions"},"content":{"rendered":"

SQL Server Functions : SQL Server functions has many built-in functions. This reference contains the string, numeric, date, conversion, and advanced functions in SQL Server.<\/p>\n

SQL Server String Functions<\/h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Function<\/strong><\/td>\nDescription<\/strong><\/td>\n<\/tr>\n
ASCII<\/td>\nReturns the number code that represents the specific character<\/td>\n<\/tr>\n
CHAR<\/td>\nReturns the ASCII character based on the number code<\/td>\n<\/tr>\n
CHARINDEX<\/td>\nReturns the location of a substring in a string<\/td>\n<\/tr>\n
CONCAT<\/td>\nConcatenates two or more strings together<\/td>\n<\/tr>\n
Concat with +<\/td>\nConcatenates two or more strings together<\/td>\n<\/tr>\n
DATALENGTH<\/td>\nReturns the length of an expression (in bytes)<\/td>\n<\/tr>\n
LEFT<\/td>\nExtracts a substring from a string (starting from left)<\/td>\n<\/tr>\n
LEN<\/td>\nReturns the length of the specified string<\/td>\n<\/tr>\n
LOWER<\/td>\nConverts a string to lower-case<\/td>\n<\/tr>\n
LTRIM<\/td>\nRemoves leading spaces from a string<\/td>\n<\/tr>\n
NCHAR<\/td>\nReturns the Unicode character based on the number code<\/td>\n<\/tr>\n
PATINDEX<\/td>\nReturns the location of a pattern in a string<\/td>\n<\/tr>\n
REPLACE<\/td>\nReplaces a sequence of characters in a string with another set of characters<\/td>\n<\/tr>\n
RIGHT<\/td>\nExtracts a substring from a string (starting from right)<\/td>\n<\/tr>\n
RTRIM<\/td>\nRemoves trailing spaces from a string<\/td>\n<\/tr>\n
SPACE<\/td>\nReturns a string with a specified number of spaces<\/td>\n<\/tr>\n
STR<\/td>\nReturns a string representation of a number<\/td>\n<\/tr>\n
STUFF<\/td>\nDeletes a sequence of characters from a string and then inserts another sequence of characters into the string, starting at a specified position<\/td>\n<\/tr>\n
SUBSTRING<\/td>\nExtracts a substring from a string<\/td>\n<\/tr>\n
UPPER<\/td>\nConverts a string to upper-case<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

SQL Server Numeric Functions<\/h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Function<\/strong><\/td>\nDescription<\/strong><\/td>\n<\/tr>\n
ABS<\/td>\nReturns the absolute value of a number<\/td>\n<\/tr>\n
AVG<\/td>\nReturns the average value of an expression<\/td>\n<\/tr>\n
CEILING<\/td>\nReturns the smallest integer value that is greater than or equal to a number<\/td>\n<\/tr>\n
COUNT<\/td>\nReturns the count of an expression<\/td>\n<\/tr>\n
FLOOR<\/td>\nReturns the largest integer value that is equal to or less than a number<\/td>\n<\/tr>\n
MAX<\/td>\nReturns the maximum value of an expression<\/td>\n<\/tr>\n
MIN<\/td>\nReturns the minimum value of an expression<\/td>\n<\/tr>\n
RAND<\/td>\nReturns a random number or a random number within a range<\/td>\n<\/tr>\n
ROUND<\/td>\nReturns a number rounded to a certain number of decimal places<\/td>\n<\/tr>\n
SIGN<\/td>\nReturns a value indicating the sign of a number<\/td>\n<\/tr>\n
SUM<\/td>\nReturns the summed value of an expression<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

SQL Server Date Functions<\/h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Function<\/strong><\/td>\nDescription<\/strong><\/td>\n<\/tr>\n
CURRENT_TIMESTAMP<\/td>\nReturns the current date and time<\/td>\n<\/tr>\n
DATEADD<\/td>\nReturns a date after a certain time\/date interval has been added<\/td>\n<\/tr>\n
DATEDIFF<\/td>\nReturns the difference between two date values, based on the interval specified<\/td>\n<\/tr>\n
DATENAME<\/td>\nReturns a specified part of a given date, as a string value<\/td>\n<\/tr>\n
DATEPART<\/td>\nReturns a specified part of a given date, as an integer value<\/td>\n<\/tr>\n
DAY<\/td>\nReturns the day of the month (from 1 to 31) for a given date<\/td>\n<\/tr>\n
GETDATE<\/td>\nReturns the current date and time<\/td>\n<\/tr>\n
GETUTCDATE<\/td>\nReturns the current UTC date and time<\/td>\n<\/tr>\n
MONTH<\/td>\nReturns the month (from 1 to 12) for a given date<\/td>\n<\/tr>\n
YEAR<\/td>\nReturns the year (as a four-digit number) for a given date<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

SQL Server Conversion Functions<\/h2>\n\n\n\n\n\n
Function<\/strong><\/td>\nDescription<\/strong><\/td>\n<\/tr>\n
CAST<\/td>\nConverts an expression from one data type to another<\/td>\n<\/tr>\n
CONVERT<\/td>\nConverts an expression from one data type to another<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

SQL Server Advanced Functions<\/h2>\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Function<\/strong><\/td>\nDescription<\/strong><\/td>\n<\/tr>\n
COALESCE<\/td>\nReturns the first non-null expression in a list<\/td>\n<\/tr>\n
CURRENT_USER<\/td>\nReturns the name of the current user in the SQL Server database<\/td>\n<\/tr>\n
ISDATE<\/td>\nReturns 1 if the expression is a valid date, otherwise 0<\/td>\n<\/tr>\n
ISNULL<\/td>\nLets you return an alternative value when an expression is NULL<\/td>\n<\/tr>\n
ISNUMERIC<\/td>\nReturns 1 if the expression is a valid number, otherwise 0<\/td>\n<\/tr>\n
NULLIF<\/td>\nCompares two expressions<\/td>\n<\/tr>\n
SESSION_USER<\/td>\nReturns the user name of the current session in the SQL Server database<\/td>\n<\/tr>\n
SESSIONPROPERTY<\/td>\nReturns the setting for a specified option of a session<\/td>\n<\/tr>\n
SYSTEM_USER<\/td>\nReturns the login name information for the current user in the SQL Server database<\/td>\n<\/tr>\n
USER_NAME<\/td>\nReturns the user name in the SQL Server database<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

SQL Server Functions : SQL Server functions has many built-in functions. This reference contains the string, numeric, date, conversion, and advanced functions in SQL Server.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386],"tags":[520,521],"class_list":["post-4391","post","type-post","status-publish","format-standard","hentry","category-sql","tag-sql-server-function","tag-sql-server-functions"],"_links":{"self":[{"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/posts\/4391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/comments?post=4391"}],"version-history":[{"count":1,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/posts\/4391\/revisions"}],"predecessor-version":[{"id":13217,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/posts\/4391\/revisions\/13217"}],"wp:attachment":[{"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/media?parent=4391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/categories?post=4391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iteducation.vivegroups.com\/wp-json\/wp\/v2\/tags?post=4391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}