Pages

Wednesday, November 11, 2015

how to clear cached queries coldfusion

how to clear cached queries coldfusion

<cfloop index="cache" array="#cacheGetAllIds()#">
<cfset cacheRemove(cache)>
</cfloop>


http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1f1ac-7fd8.html

Thursday, November 5, 2015

very useful functions: ISNULL and NULLIF -


this we can use when we want to replace null with your own value.

ISNULL

columnName - is null here
my value -- your custom value

select ISNULL(columnName ,'my value') as newvalue, *  from  table



--------------------------------------------------------------------------------------------



 NULLif

here function will display NULL if columnName mataches with yourValue
else it will display column's value from table

select NULLif( columnName,'yourValue') as NEWcurrencycode, * from  table


Wednesday, October 14, 2015

Sql things -- create comma separated list of values of a column in ms sql

1. To convert integer column values to varchar in ms sql


1. SELECT CONVERT(varchar(10), PType_ID) FROM PType

2. create comma separated list of values of a column in ms sql 

Declare @Str varchar(max)
select @Str = coalesce (@Str +',' ,'') + convert(varchar(10) , PriceType_ID )
from PriceType with (NOLOCK)
where PriceTypeCode in ('01', '02', '03', '04')

select @lStr as val

note: here PriceType_ID  is a integer column so i need to convert it to varchar.
in case if this column is already varchar then you do not need to use convert function. 

Tuesday, March 3, 2015

sql query to find matching columns in all tables

ms sql, matching columns in table, 

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%tag%'



tag: table name


this query will help you to find all matching columns in tables 

Thursday, February 19, 2015

java.lang.StackOverflowError at coldfusion.runtime.NeoBodyContent.cfoutput(NeoBodyContent.java:121) at

java.lang.StackOverflowError at coldfusion.runtime.NeoBodyContent.cfoutput(NeoBodyContent.java:121)


check below items in your code to fix this error.

1. this is mainly with coldfusion memory leak
2. this may be because of coldfusion variable conflict with same names.
3. coldfusion may trying to find the variable/object with same name in a CFC which has same name of object.

4. try to find same variable name in your own CFC which you are creating and same variable name in CFCs which you created. 
its possible CFCs that you created they are using same variable scope variable name and same CFC object 

Monday, January 12, 2015

[Macromedia][SQLServer JDBC Driver][SQLServer]The multi-part identifier could not be bound.

 [Macromedia][SQLServer JDBC Driver][SQLServer]The multi-part identifier "local.QryVatCode.VatCode_id" could not be bound.



this will come when you dont use ## signs inside in cfquery for any dynamic variable execution,


think if you are doing something like this.


<cfquery>
insert table1 (col1)
values (val1)
</cfquery>


if val1 is a coldfusion variable, then you have to do #val1#


<cfquery>
insert table1 (col1)
values (#val1#)
</cfquery>



Dynamically display all column data of a cfquery // get column value dynamically cfquery coldfusion //


Dynamically display all column data of a cfquery. 

this is useful when you don't know the name of columns of your cfquery result.


<cfloop query="Data">

       <cfloop list="#data.Columnlist#" index="local.Column" delimiters="," >

        <cfoutput>
              #Data[local.column][Data.currentrow]#
        </cfoutput>

</cfloop>
</cfloop>



Notes: 
1. data is query
2. data.columnlist is comma separted columnlist of a query

Monday, January 5, 2015

[Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.


Coldfusion 

ErrorCode1205

Deadlock Transaction because of cftransaction. 

Error is:
[Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

java.sql.SQLTransactionRollbackException: [Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim.



<cfquery name="qryGetLastID" datasource="#variables.Pub_DS#">
      SET NOCOUNT ON

      insert into table
      (column1,datecreated,createdby)
      values(1,2,3)

      SELECT @@Identity AS maxID
      SET NOCOUNT OF
</cfquery>