Category Archives: SQL

Odd SQL Server Error message

This one took me a few minutes to figure out. “Incorrect syntax near ‘@P2’. “. At first I thought my Colfusion server was having an issue with an email address I was inserting but the “P2” was not in the … Continue reading

Posted in Problems & Fixes, SQL | Tagged , | Comments Off on Odd SQL Server Error message

Coldfusion working around SQL Server Key words

In one of our older database tables we have a field named “ROLLUP”. For SQL SERVER 2008 this is a reserved word. When writing dynamic SQL with group by statements using the column name “rollup” coldfusion will throw a syntax … Continue reading

Posted in Coldfusion, Problems & Fixes, Snippets, SQL | Comments Off on Coldfusion working around SQL Server Key words

SQL Server – Reset Identity Column

How to reset the identity counter in SQL SERVER DBCC CHECKIDENT(‘tablename’, RESEED, 0) The zero can be any positive value. I often use the year as numbering system like 2012000001

Posted in Snippets, SQL | Comments Off on SQL Server – Reset Identity Column

CFQueryParam with Lists

If you have a form that gathers an element where the user can enter several items separated by commas, coldfusion gives you a couple of ways to deal with the sql statement. In older versions you might loop through the … Continue reading

Posted in Code, Coldfusion, Snippets, SQL | Comments Off on CFQueryParam with Lists

SQL Rows to Column

I had an interesting challenge this week where I needed to turn rows of email addresses into a crosstab or a single column so I could use it to send out emails. I had to do this at a grouped … Continue reading

Posted in Code, Snippets, SQL | Tagged , , | Comments Off on SQL Rows to Column