Assuming varchar is required, the following 31 results were found.
Month Number MONTH(now()) DATEPART(mm, getdate()) European Date (dd/mm/yyyy) DATE_FORMAT(now(), '%d/%m/%Y') CONVERT(varchar, getdate(), 103) Time to Seconds TIME_TO_SEC(now()) (DATEPART(hour, getdate()) * 3600) + (DATEPART(minute, getdate()) * 60) +...
LIKE @GivenForenames + '%' OR @GivenForenames = '') AND (Surname LIKE @GivenSurname OR @GivenSurname = '') AND (CONVERT(VARCHAR(10),DOB, 103) = @GivenDOB OR @GivenDOB = '') AND (@GivenRef'' OR @GivenForenames'' OR @GivenSurname'' OR @GivenDOB'') -- The...
Strip HTML in MySQLhttps://www.joellipman.com/articles/database/mysql/strip-html-in-mysql.html
log_bin_trust_function_creators=1; DROP FUNCTION IF EXISTS fnStripTags; DELIMITER | CREATE FUNCTION fnStripTags( Dirty varchar(4000) ) RETURNS varchar(4000) DETERMINISTIC BEGIN DECLARE iStart, iEnd, iLength int; WHILE Locate( '', Dirty, Locate( '',...
the insert(s) into the new table `#_categories` where `id` > 7 Add column in #_content just before note called `xreference` VARCHAR(50) allows NULL. Import Content (articles): export SQL file and amend the insert(s) into the new table `#_content` Import...
Numeric Decimal Varies Maximum width + 2 bytes String Char Range 1-255 characters Always filled max width String VarChar Range 1-255 characters Length of string + 1 byte String TinyBlob, TinyText Max length 255 characters Length of string + 1 byte...
must be able to search on EITHER the student's username or the student's ID (2 report parameters: @StudentADAccount [varchar] and @StudentReference [int] respectively). Most of the remaining datasets use the resulting @StudentReference number in their...
text DEFAULT ''; -- return string holder DECLARE temp_str text DEFAULT ''; -- temporary string holder DECLARE temp_val VARCHAR(255) DEFAULT ''; -- temporary string holder for query -- get length SET str_len=LENGTH(str); SET i =...
we should determine the position of the last needle first (reverse the haystack string and find needle): DECLARE @Haystack VARCHAR(31); SET @Haystack = 'String1.String2.String3.String4'; -- I want "String4" from Haystack SET @Delimiter = '.'; PRINT...
the opening and closing XML tags: -- Using .query() SELECT CAST(CAST(Event_XML AS XML).query('data(/STAFF/GENDER)') AS VARCHAR(10)) AS Gender FROM [dbo].[XML_EVENTS] -- Returns column GENDER for every record/row (eg. "Male") Or -- Using .value() SELECT...
DELIMITER | CREATE TRIGGER incrementUrlAlias BEFORE INSERT ON my_table_name FOR EACH ROW BEGIN declare original_url varchar(255); declare url_counter int; set original_url = new.url_alias; set url_counter = 1; while exists (select true from...
and just leaves VALUE. Why? Do we need a reason? How? For SQL Server 2005 or later, using T-SQL: DECLARE @myStringToParse VARCHAR(max), @myXML XML; SET @myStringToParse = 'Title,Forenames,Surname'; SELECT @myXml = CONVERT(xml,'' +...