Database Sizes in PostgreSQL
Script for displaying database sizes in PostgreSQL
Script for displaying database sizes in PostgreSQL
Example of checking if a string contains only digits: SELECT * FROM my_table WHERE user_name NOT LIKE '%[^0-9]%';
Example of applying SPLIT_STRING for all rows in the set using one script. -- Creating a dataset for the example declare @tbl table(path varchar(max)); insert into @tbl select 'root_home_user' union select 'lib_var_simple' union select 'var_...
Example of returning a parameter when executing a dynamically created query. May be useful in cases where you need to return parameters for further processing in a script, for example, a procedure. We will use this for <b>sp_executesql</b>.
IN select * from Rating where ID_PLAYER in ( select ID_PLAYER from Players where PLAYER_STATUS = 'Active' ); EXISTS select * from Rating r where exists ( select 1 from Players p where p.ID_PLAYER = r.ID_PLAYER and p.PLAYER_STATUS = 'Acti…
Table Hints Table Hints relate only to tables and views for which they are specified. These hints are intended to determine the locking method, specify a particular index, and the method of data processing in tables, for example, scanning or searching. Syntax: Arguments: With the keyword
To add a comment to a table field in MSSQL, use: To change a comment to a table field in MSSQL, use: To delete a comment to a table field in MSSQL, use:
Добавление описания к полю в таблице EXEC sp_addextendedproperty @name = N\'MS_Description\', @value = N\'Описание поля\', @level0type = N\'SCHEMA\', @level0name = N\'CRM\', -- Вместо \'dbo\' ставим название своей схемы если отличается @lev…
Examples of getting the query text by session identifier DECLARE @sqltext VARBINARY(128) SELECT @sqltext = sql_handle FROM sys.sysprocesses WHERE spid = (YourSessionID) SELECT TEXT FROM sys.dm_exec_sql_text(@sqltext) GO SELECT TEXT FROM sy…
Example of selecting fields from a temporary table with all parameters. Can be used for regular tables as well. #tmp - your temporary table