What is my mysql version

what is my mysql version Mysql version mysql -V find mysql version linux SHOW VARIABLES LIKE “%version%”; +————————-+——————————————+ | Variable_name | Value | +————————-+——————————————+ | protocol_version | 10 | | version | 5.0.27-standard | | version_comment | MySQL Community Edition – Standard (GPL) | | version_compile_machine | i686 | | version_compile_os | pc-linux-gnu | +————————-+——————————————+ […]

What is my mysql version Read More

Tsql print julia rows

tsql print julia rows — generate a guid table ;with guids( i, guid ) as ( select 1 as i, newid() union all select i + 1, newid() from guids where i < 20 ) — print julia triangle select replicate(‘* ‘, i) from guids order by i desc

Tsql print julia rows Read More

Triggers in sql

triggers in sql Trigger: A trigger is a stored procedure in database which automatically invokes whenever a special event in the database occurs. For example, a trigger can be invoked when a row is inserted into a specified table or when certain table columns are being updated. Syntax: create trigger [trigger_name] [before | after] {insert […]

Triggers in sql Read More

Sqlite datetime

sqlite datetime — SQLite — — Every database system has it’s own set of — functions specifically tasked for handling dates and times. — These functions are not standardized. — Date and time related functions for SQLite SELECT DATETIME(‘now’); –> Result UTC Time: 2020-11-24 11:31:02 SELECT DATE(‘now’); –> Result: 2020-11-24 SELECT DATETIME(‘now’, ‘+1 day’); –> […]

Sqlite datetime Read More

Sql server rename mdf file

sql server rename mdf file USE [master]; GO ALTER DATABASE QuestelServicesDirectValidation_ORIG SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO ALTER DATABASE QuestelServicesDirectValidation_ORIG SET OFFLINE GO ALTER DATABASE QuestelServicesDirectValidation_ORIG MODIFY FILE (Name=’QuestelServicesDirectValidation_ORIG’, FILENAME=’C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\QuestelServicesDirectValidation_ORIG.mdf’) GO ALTER DATABASE QuestelServicesDirectValidation_ORIG MODIFY FILE (Name=’QuestelServicesDirectValidation_ORIG_log’, FILENAME=’C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\QuestelServicesDirectValidation_ORIG_log.ldf’) GO ALTER DATABASE QuestelServicesDirectValidation_ORIG SET ONLINE GO ALTER DATABASE QuestelServicesDirectValidation_ORIG SET […]

Sql server rename mdf file Read More

Sql server get current date

sql server get current date GETDATE() sql server current date GETDATE() sql display today’s date SELECT getdate() sql get date SELECT GETDATE(); sql current date Add GETDATE() in sql query where you want to pass current timestamp. Example Return the current database system date and time: SELECT GETDATE(); get current date sql SELECT getdate(); — […]

Sql server get current date Read More

Sql server convert to guid

sql server convert to guid DECLARE @uuid VARCHAR(50) SET @uuid = ‘a89b1acd95016ae6b9c8aabb07da2010’ SELECT CAST( SUBSTRING(@uuid, 1, 8) + ‘-‘ + SUBSTRING(@uuid, 9, 4) + ‘-‘ + SUBSTRING(@uuid, 13, 4) + ‘-‘ + SUBSTRING(@uuid, 17, 4) + ‘-‘ + SUBSTRING(@uuid, 21, 12) AS UNIQUEIDENTIFIER)

Sql server convert to guid Read More

Sql select statement

sql select statement SELECT * FROM table_name; –or SELECT column1, column2 FROM table_name; sql select syntax select [all/distinct] <col1>, <col2>, <col3> from <table_name> [join <join_condition>] [where <condition>] [group by <column_name>] [having <search_condition>] [order by <sort_specification>] /* Specifically for SQL -> Oracle LEGEND: […] : optional entries <…> : your specific entry */</sort_specification></search_condition></column_name></condition></join_condition></table_name></col3></col2></col1> SELECt sql SELECT […]

Sql select statement Read More

Sql select all records from all tables where not empty

sql select all records from all tables where not empty SELECT r.table_name, r.row_count, r.[object_id] FROM sys.tables t INNER JOIN ( SELECT OBJECT_NAME(s.[object_id]) table_name, SUM(s.row_count) row_count, s.[object_id] FROM sys.dm_db_partition_stats s WHERE s.index_id in (0,1) GROUP BY s.[object_id] ) r on t.[object_id] = r.[object_id] WHERE r.row_count > 0 ORDER BY r.table_name;

Sql select all records from all tables where not empty Read More