Mar
24
2026
SELECT id, ownership
FROM tbl_test
WHERE
lang = <cfqueryparam cfsqltype="cf_sql_char" maxlength="2" value="en">
and
(
REPLACE(REPLACE(ownership, CHAR(13), ''), CHAR(10), '') like <cfqueryparam value="%#reReplace(arguments.real_beneficiaries, "[\r\n]", "", "all")#%" cfsqltype="cf_sql_nvarchar">
OR
REPLACE(REPLACE(ownership, CHAR(13), ''), CHAR(10), '') like <cfqueryparam value="#reReplace(arguments.real_beneficiaries, "[\r\n]", "", "all")#%" cfsqltype="cf_sql_nvarchar">
OR
REPLACE(REPLACE(ownership, CHAR(13), ''), CHAR(10), '') like <cfqueryparam value="%#reReplace(arguments.real_beneficiaries, "[\r\n]", "", "all")#" cfsqltype="cf_sql_nvarchar">
OR
REPLACE(REPLACE(ownership, CHAR(13), ''), CHAR(10), '') = <cfqueryparam value="#reReplace(arguments.real_beneficiaries, "[\r\n]", "", "all")#" cfsqltype="cf_sql_nvarchar">
)
no comments | posted in Coldfusion, MSSQL Database Development
Apr
8
2025
SELECT TOP 5 LEFT(DATEOPEN, 10) FROM tbl_dates where LEFT(DATEOPEN, 10) < '2021-01-01'
2019-10-16
2011-04-13
2014-06-13
2014-06-18
2012-03-29
2012-03-29
SELECT TOP 5 LEFT(DATEOPEN, 10) FROM tbl_dates where LEFT(DATEOPEN, 10) > '2021-01-01'
2022-05-20
2023-01-11
2022-05-05
2022-12-09
2021-06-21
2021-06-21
no comments | posted in MSSQL Database Development
Mar
21
2025
DECLARE @sql NVARCHAR(MAX) = ''
SELECT @sql = @sql + 'TRUNCATE TABLE [' + TABLE_SCHEMA + '].[' + TABLE_NAME + '] ' + CHAR(10)
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'MYSCHEMA' -- Change this to your schema
AND TABLE_NAME LIKE '%test%' -- Find tables containing 'test' in the name
PRINT @sql -- Check the generated SQL (optional)
EXEC sp_executesql @sql -- Execute the truncation
no comments | posted in MSSQL Database Development
Jan
16
2025
DECLARE @query_date DATE = '2025-01-15'
SELECT * from tbl_dates WHERE mydate = @query_date
no comments | posted in MSSQL Database Development
Nov
28
2024
<cfset myArray = ["apple", "banana", "apple", "orange", "banana"]>
<!-- Use a struct to remove duplicates -->
<cfset uniqueStruct = {}>
<cfloop array="#myArray#" index="item">
<cfset uniqueStruct[item] = true>
</cfloop>
<!-- Convert struct keys back to array -->
<cfset uniqueArray = StructKeyArray(uniqueStruct)>
<cfdump var="#uniqueArray#">
no comments | posted in Coldfusion
Jun
5
2024
<!--- Syntax: ((condition) ? trueStatement : falseStatement) --->
<cfset width = ((ThumbnailWidth EQ 0) ? 75 : ThumbnailWidth) />
no comments | posted in Coldfusion
Jun
1
2024
// Create an instance of the mail object
mail=new mail();
// Set it's properties
mail.setSubject( "Sample Email" );
mail.setTo( "to@example.com" );
mail.setFrom( "from@example.com" );
mail.setCC( "cc@example.com" );
mail.setBCC( "bcc@example.com" );
// Add an attachment
mail.addParam( file="C:\foo.txt" );
// Add email body content in text and HTML formats
mail.addPart( type="text", charset="utf-8", wraptext="72", body="This is a test message." );
mail.addPart( type="html", charset="utf-8", body="<p>This is a test message.</p>" );
// Send the email
mail.send();
source: https://stackoverflow.com/questions/8423276/how-do-you-send-an-email-with-an-attachment-using-cfscript-in-cf9
no comments | posted in Coldfusion
Mar
27
2024
Create Function [dbo].[RemoveNonAlphaCharacters](@Temp VarChar(1000))
Returns VarChar(1000)
AS
Begin
Declare @KeepValues as varchar(50)
Set @KeepValues = '%[^a-z]%'
While PatIndex(@KeepValues, @Temp) > 0
Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '')
Return @Temp
End
Select dbo.RemoveNonAlphaCharacters('abc1234def5678ghi90jkl')
source: https://stackoverflow.com/questions/1007697/how-to-strip-all-non-alphabetic-characters-from-string-in-sql-server
no comments | posted in MSSQL Database Development
Jan
28
2024
“This error essentially means that you need to add more memory, or reconfigure your garbage collection arguments. You can suppress this error by adding -XX:-UseGCOverheadLimit to your JVM startup arguments”
Note to self – don’t do it! It will block your entire windows virtual machine! Already seen and done!!!
source:
https://www.petefreitag.com/blog/outofmemoryerror-gc-overhead/
no comments | posted in Coldfusion
Jan
4
2024
I’m running cf2023 on windows and I’m having a weird problem with basic functionality that was working normally on the cf2016 version I was using earlier.
Every attempt to generate a csv file in which the Croatian characters will be displayed correctly has so far been unsuccessful.
I tried changing the JVM arguments and adding -Dfile.encoding=UTF8 but it didn’t help.
BOM header problem – adding #CHR(65279)# to the beginning of the csv content helped.
<cfprocessingdirective pageencoding="utf-8">
<cfset content = '#CHR(65279)#priča;požarevac;PRIŠTINA;ČAKOVEC;ŽUPANJA;ĐAKOVO;rođak'>
<cffile action="write"
file="#expandPath('temp')#/test.csv"
output="#content#"
addnewline="yes" charset="utf-8">
source: https://community.adobe.com/t5/coldfusion-discussions/adding-utf-8-bom-byte-order-mark-to-file-output/m-p/11745053
no comments | posted in Coldfusion