Simple SQL Query sometimes really Slow?

2013-12-05 Thread Brook Davies
This may not be the right place to post this (man, CF-TALK has changed a lot in the last 5 or so years ;)). I have a simple SQL query that is showing up as running slow. When I run it via the Management Studio it is sometimes fast 0.1 seconds and sometimes, seemingly randomly slow 1.5 minutes

RE: Simple SQL Query sometimes really Slow?

2013-12-05 Thread Mark A Kruger
- From: Brook Davies [mailto:cft...@logiforms.com] Sent: Thursday, December 05, 2013 11:26 AM To: cf-talk Subject: Simple SQL Query sometimes really Slow? This may not be the right place to post this (man, CF-TALK has changed a lot in the last 5 or so years ;)). I have a simple SQL query

Re: Simple SQL Query sometimes really Slow?

2013-12-05 Thread Jon Clausen
are happening: http://msdn.microsoft.com/en-us/library/tcbchxcb%28VS.80%29.aspx HTH, Jon On Dec 5, 2013, at 12:26 PM, Brook Davies cft...@logiforms.com wrote: This may not be the right place to post this (man, CF-TALK has changed a lot in the last 5 or so years ;)). I have a simple SQL

re: Simple SQL Query sometimes really Slow?

2013-12-05 Thread Jeff Garza
-to-force-ind ex-query-hints-index-hint-part2/ Hope this helps, -- Jeff Original Message From: Brook Davies cft...@logiforms.com Sent: Thursday, December 05, 2013 10:27 AM To: cf-talk cf-talk@houseoffusion.com Subject: Simple SQL Query sometimes really Slow? This may

Re: Simple SQL Query sometimes really Slow?

2013-12-05 Thread richpaul7 .
[mailto:cft...@logiforms.com] Sent: Thursday, December 05, 2013 11:26 AM To: cf-talk Subject: Simple SQL Query sometimes really Slow? This may not be the right place to post this (man, CF-TALK has changed a lot in the last 5 or so years ;)). I have a simple SQL query that is showing up

Re: Simple SQL Query sometimes really Slow?

2013-12-05 Thread Byron Mann
: This may not be the right place to post this (man, CF-TALK has changed a lot in the last 5 or so years ;)). I have a simple SQL query that is showing up as running slow. When I run it via the Management Studio it is sometimes fast 0.1 seconds and sometimes, seemingly randomly slow 1.5 minutes

RE: Simple SQL Query sometimes really Slow?

2013-12-05 Thread Brook Davies
, I'll try them! Whohoo! Cftalk is alive!! Brook -Original Message- From: Byron Mann [mailto:byronos...@gmail.com] Sent: December-05-13 10:22 AM To: cf-talk Subject: Re: Simple SQL Query sometimes really Slow? Could never figure this out, but we had a similar issue on 2005 with a date

Weird SQL Query happenings...

2011-11-30 Thread DURETTE, STEVEN J
Hi all, Here is a little background... CF: ColdFusion Server Enterprise 8,0,1,195765 SQL: Microsoft SQL Server 2008 R2 I have a stored procedure that when I run from SSMS it runs perfectly and returns 2000 rows. When I run it from a cfstoredproc tag it returns no rows at all. I just changed

Re: Weird SQL Query happenings...

2011-11-30 Thread Judah McAuley
Is it returning multiple recordsets perhaps? Or possibly returning a cursor to the recordset? Judah On Wed, Nov 30, 2011 at 11:18 AM, DURETTE, STEVEN J sd1...@att.com wrote: Hi all, Here is a little background... CF: ColdFusion Server Enterprise 8,0,1,195765 SQL: Microsoft SQL Server 2008

RE: Weird SQL Query happenings...

2011-11-30 Thread DURETTE, STEVEN J
: Wednesday, November 30, 2011 2:28 PM To: cf-talk Subject: Re: Weird SQL Query happenings... Is it returning multiple recordsets perhaps? Or possibly returning a cursor to the recordset? Judah ~| Order the Adobe Coldfusion Anthology

Re: Weird SQL Query happenings...

2011-11-30 Thread Leigh
Anything unusual about the procedure like optional parameters? (I know you said the input values are exactly the same, but ...) did you compare the debug information from cfquery and cfstoredproc? Just to verify everything truly is the same (values, data types, parameter position). Another

Re: Weird SQL Query happenings...

2011-11-30 Thread Leigh
don't return the same record set. Hm.. on second thought I may have read that wrong. If the resultset you are getting back contains the correct column names just no records - then ignore my comment about NOCOUNT. It does not apply.   -Leigh

RE: Weird SQL Query happenings...

2011-11-30 Thread DURETTE, STEVEN J
I checked, everything is exactly the same for both calls. Yes we do set NOCOUNT ON. Yes it returns the proper columns just no data. Steve -Original Message- From: Leigh [mailto:cfsearch...@yahoo.com] Sent: Wednesday, November 30, 2011 3:51 PM To: cf-talk Subject: Re: Weird SQL Query

Re: Weird SQL Query happenings...

2011-11-30 Thread Leigh
Other than that the only thing I can think of would be tracing it or using the profiler to see what is happening.at a db level. Because it does not make sense the same parameters would return different results. -Leigh ~|

Re: Weird SQL Query happenings...

2011-11-30 Thread Judah McAuley
If you run the profiler and it says that it is returning the correct number of records in the sp that was run, you could also take a look at FusionReactor and use their JDBC wrappers to see if something is going on at the JDBC level. Judah On Wed, Nov 30, 2011 at 1:33 PM, Leigh

Re: Weird SQL Query happenings...

2011-11-30 Thread Russ Michaels
my memory is a little hazy on the subject, but I do recall some odd issues like this with cfstoredproc. Are you using cfstoredprocparam ? if so, make sure you pass the params in in the exact same order as they are defined in the stored proc itself, if I recall this is one of the causes of such

Re: Weird SQL Query happenings...

2011-11-30 Thread Paul Hastings
On 12/1/2011 2:18 AM, DURETTE, STEVEN J wrote: I have a stored procedure that when I run from SSMS it runs perfectly and returns 2000 rows. When I run it from a cfstoredproc tag it returns no rows seen something somewhat similar w/sql server 2008 datadirect drivers but this was always w/sp

SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many thanks, Jenny ~| Order the Adobe Coldfusion Anthology now!

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
select * from b where id not in (select id from a) On Tue, Jun 21, 2011 at 12:37 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many

Re: SQL Query Problem

2011-06-21 Thread Greg Morphis
if your tables are large, you'll probably see a better performance from select id from TableA a where not exists (select 1 from TableB b where a.id = b.id) On Tue, Jun 21, 2011 at 12:41 PM, John M Bliss bliss.j...@gmail.com wrote: select * from b where id not in (select id from a) On Tue,

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Thanks John and Greg :) -Original Message- From: Greg Morphis [mailto:gmorp...@gmail.com] Sent: 21 June 2011 18:45 To: cf-talk Subject: Re: SQL Query Problem if your tables are large, you'll probably see a better performance from select id from TableA a where not exists (select 1

Re: SQL Query Problem

2011-06-21 Thread Carl Von Stetten
How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On 6/21/2011 10:37 AM, Jenny Gavin-Wear wrote: Two tables each containing a shared primary key ID. I am trying to create a query that lists records from table B that are not in table A. Many thanks,

Re: SQL Query Problem

2011-06-21 Thread Stephane Vantroyen
I would do it this way : select b.* from b where b.id not in (select a.id from a) How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On 6/21/2011 10:37 AM, Jenny Gavin-Wear wrote: ~|

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
That looks familiar! :-) On Tue, Jun 21, 2011 at 1:09 PM, Stephane Vantroyen s...@emakina.com wrote: I would do it this way : select b.* from b where b.id not in (select a.id from a) How about: select b.* from b left outer join a on b.id = a.id where a.id is null Carl On

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Looks like I went with the vote, lol Many thanks for all replies, and fast too :) Some payments from Paypal transactions, some manually entered on profiles. Legacy code :/ Jenny select * from tbl_members where (datepart(m,paid) = #session.month# and datepart(,paid) = #session.year# AND

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many thanks for all replies, and fast too :) Some payments from Paypal transactions, some manually entered on

Re: SQL Query Problem

2011-06-21 Thread Ras Tafari
+420 On Tue, Jun 21, 2011 at 2:45 PM, Michael Grant mgr...@modus.bz wrote: Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many thanks for all replies, and fast

Re: SQL Query Problem

2011-06-21 Thread John M Bliss
She didn't provide column names... On Tue, Jun 21, 2011 at 1:45 PM, Michael Grant mgr...@modus.bz wrote: Off topic, but the Select * made me shudder. On Tue, Jun 21, 2011 at 2:25 PM, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: Looks like I went with the vote, lol Many

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
I was waiting for a comment on that. It's a very small table :) -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 19:46 To: cf-talk Subject: Re: SQL Query Problem Off topic, but the Select * made me shudder

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
, Jenny Gavin-Wear jenn...@fasttrackonline.co.uk wrote: I was waiting for a comment on that. It's a very small table :) -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 19:46 To: cf-talk Subject: Re: SQL Query Problem Off topic, but the Select

RE: SQL Query Problem

2011-06-21 Thread Jenny Gavin-Wear
Hi Michael, The (very old) web site is about to be completely redeveloped, so I'm really not too worried. Appreciate your concern though :) Jenny -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 23:27 To: cf-talk Subject: Re: SQL Query Problem

Re: SQL Query Problem

2011-06-21 Thread Michael Grant
: Michael Grant [mailto:mgr...@modus.bz] Sent: 21 June 2011 23:27 To: cf-talk Subject: Re: SQL Query Problem Right, but if that table grows and columns are added, the overhead on your query will grow. Having a small table makes it even easier to define the columns in your select list

Re: SQL query question

2011-02-02 Thread Sean Henderson
With ColdFusion 9, we ended up replacing all the wildcard selects with actual column names, among other fortifications. We did not experience this issue on 6.1. ~| Order the Adobe Coldfusion Anthology now!

SQL query question

2011-02-01 Thread Debbie Morris
Since everyone should be in a SQL Join state of mind...here's another one. I have a weird issue that I haven't been able to narrow down yet. I'm trying to add a new field to one of my tables to store some additional information, but once I add the column, my previously working query breaks.

Re: SQL query question

2011-02-01 Thread Charlie Stell
This might be an issue I've had to deal with before. Do something to change the fingerprint (no idea what the correct term would be) of the query - or restart cf. By change the fingerprint, it could be something as simple ad swapping p.* and pt.* (swapping as in their ordinal position in the

Re: SQL query question

2011-02-01 Thread Ian Skinner
On 2/1/2011 1:23 PM, Debbie Morris wrote: What am I overlooking? The evil of using * in SELECT clauses. When that is done, database drivers are know to cache the columns and datatypes of the SQL queries. Then somebody comes along and changes the database structure, like you adding a field.

Re: SQL query question

2011-02-01 Thread Ian Skinner
On 2/1/2011 2:21 PM, Charlie Stell wrote: I assume this is something on CF's side - as restarting the CF service also fixes it. Not ColdFusion itself, but the database drivers used by ColdFusion and the cached (pooled) data source settings. Changing the Datasource to not used pooled settings

Re: SQL query question

2011-02-01 Thread Michael Grant
The evil of using * in SELECT clauses. I'm with Ian on this 100%. Often times developers think that using * will be faster, and easier and allow more flexibility. However that couldn't be further from the truth as you are seeing now. Take Ian's advice and define each column you want from your

RE: SQL query question

2011-02-01 Thread Debbie Morris
, so I'll tackle this again in the morning. Thanks for the help! Debbie -Original Message- From: Michael Grant [mailto:mgr...@modus.bz] Sent: Tuesday, February 01, 2011 5:41 PM To: cf-talk Subject: Re: SQL query question The evil of using * in SELECT clauses. I'm with Ian on this 100

sql query builder, web based

2010-03-17 Thread Tom Jones
Hello, I was wondering if there were any good sql query builders that I can add to my application. I found a jquery plugin called Sqlquerybuilder (http://plugins.jquery.com/project/SQL_QUERY_BUILDER). It's almost what I need but the saved queries will break if the schema changes since all

sql query builder, web based

2010-03-17 Thread Tom Jones
Hello, I was wondering if there were any good sql query builders that I can add to my application. I found a jquery plugin called Sqlquerybuilder (http://plugins.jquery.com/project/SQL_QUERY_BUILDER). It's almost what I need but the saved queries will break if the schema changes since all

WebBased SQL query builder

2010-03-17 Thread Tom Jones
Hello, I was wondering if there were any good sql query builders that I can add to my application. I found a jquery plugin called Sqlquerybuilder (http://plugins.jquery.com/project/SQL_QUERY_BUILDER). It's almost what I need but the saved queries will break if the schema changes since all

sql query builder, web based

2010-03-17 Thread Tom Jones
Hello, I was wondering if there were any good sql query builders that I can add to my application. I found a jquery plugin called Sqlquerybuilder (http://plugins.jquery.com/project/SQL_QUERY_BUILDER). It's almost what I need but the saved queries will break if the schema changes since all

WebBased SQL query builder

2010-03-17 Thread Tom Jones
Hello, I was wondering if there were any good sql query builders that I can add to my application. I found a jquery plugin called Sqlquerybuilder (http://plugins.jquery.com/project/SQL_QUERY_BUILDER). It's almost what I need but the saved queries will break if the schema changes since all

(ot) SQL query aliases in SQL Management Studio

2009-12-22 Thread Jason Durham
My apologies for posting an OT message to a ColdFusion list. RDMS are so closely tied to our day-to-day job in writing CF, that perhaps the list will be tolerant of such a question. I'm writing a View for our CRM package to use. The SQL works as I've written it, but Management Studio keeps

Re: (ot) SQL query aliases in SQL Management Studio

2009-12-22 Thread Dave Sueltenfuss
Hi Jason, I would recommended creating the view from a query window, and not the design view that SQL Management studio uses Simply add a 'Create View dbo. AS' before the statement that works and run it in the query window Hope this helps -Dave On Tue, Dec 22, 2009 at 11:34 AM, Jason

RE: (ot) SQL query aliases in SQL Management Studio

2009-12-22 Thread Jason Durham
Subject: Re: (ot) SQL query aliases in SQL Management Studio Hi Jason, I would recommended creating the view from a query window, and not the design view that SQL Management studio uses Simply add a 'Create View dbo. AS' before the statement that works and run it in the query window Hope

Re: (ot) SQL query aliases in SQL Management Studio

2009-12-22 Thread Leigh
I would recommended creating the view from a query window, and not the design view that SQL Management studio uses +1 . Traditionally design views and wizards do unspeakable things to your nicely formatted sql. -Leigh

Re: (ot) SQL query aliases in SQL Management Studio

2009-12-22 Thread Jason Fisher
It looks like the reason for the original rewrite was due to subquerying the same table twice. Nothing wrong with that, but the wizard decides to ensure that every reference is unique, thus the aliasing of the second reference. You could get around that by adding your own table aliases in

Can I do this in a single SQL query?

2009-02-24 Thread Jim McAtee
and email columns populated, while new comments have the userid populated instead. users userid int username varchar email varchar ... comments commentid int userid int name varchar email varchar commentvarchar ... Is there a single SQL query

RE: Can I do this in a single SQL query?

2009-02-24 Thread William Seiter
Can you update the comments table when a new registration happens, with the userid that matches the email address? William -Original Message- From: Jim McAtee [mailto:jmca...@mediaodyssey.com] Sent: Tuesday, February 24, 2009 6:26 PM To: cf-talk Subject: Can I do this in a single SQL

Re: Can I do this in a single SQL query?

2009-02-24 Thread Matt Williams
On Tue, Feb 24, 2009 at 9:25 PM, Jim McAtee jmca...@mediaodyssey.com wrote: The new system requires user registration and new comments are now tied directly to a user account.  What I'd like to do is link any newly registered users to their old comments by using the email address.  It's

Re: Can I do this in a single SQL query?

2009-02-24 Thread Jim McAtee
- Original Message - From: Matt Williams mgw...@gmail.com To: cf-talk cf-talk@houseoffusion.com Sent: Tuesday, February 24, 2009 7:47 PM Subject: Re: Can I do this in a single SQL query? UPDATE comments SET userID = ( SELECT userID FROM users WHERE users.email = comments.email

RE: SQL query sorting problem

2009-01-26 Thread Dawson, Michael
The proper solution would be a separate table that contains the state codes with their desired sort order. That table is joined to the main table. This is probably best if you have to list all 50+ states. If you only need to list three states, then I would use CASE as Azadi suggested. In

Re: SQL query sorting problem

2009-01-26 Thread Chris Blackwell
DBMS is MySQL 5. I have a report that is generated for cities within several states. The states are designated by their two letter postal abbreviations and are in a certain order. For example: 1. NY 2. CA 3. FL I would like the records of the report sorted by the original state order, then

Re: SQL query sorting problem

2009-01-26 Thread Azadi Saryev
Mike, the way i read OP's question is that the order of states is not fixed, but user-defined: i.e. a user selects several states in several select lists and the data returned must be in the order of selected states. but in case of pre-defined order of states, your suggestion will be perfect.

Re: SQL query sorting problem

2009-01-26 Thread Azadi Saryev
that's very neat, chris! i didn't think one could use FIND_IN_SET in ORDER BY clause - live and learn! Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Chris Blackwell wrote: You can do this in a very easy and elegant manner with MySQL. No need for join or nasty case statements SELECT *

Re: SQL query sorting problem

2009-01-26 Thread Jim McAtee
Michael, Thanks. That worked perfectly. Jim - Original Message - From: Dawson, Michael m...@evansville.edu To: cf-talk cf-talk@houseoffusion.com Sent: Monday, January 26, 2009 8:07 AM Subject: RE: SQL query sorting problem The proper solution would be a separate table that contains

SQL query sorting problem

2009-01-25 Thread Jim McAtee
DBMS is MySQL 5. I have a report that is generated for cities within several states. The states are designated by their two letter postal abbreviations and are in a certain order. For example: 1. NY 2. CA 3. FL I would like the records of the report sorted by the original state order, then

Re: SQL query sorting problem

2009-01-25 Thread Azadi Saryev
rty a UNION query generated inside a cfloop: cfquery ... cfloop from=1 to=#listlen(states)# index=j (SELECT *, #j# AS sortcol FROM cities WHERE state = '#listgetat(states, j)#') cfif j lt listlen(states)UNION /cfif /cfloop ORDER BY sortcol, city /cfquery you could also probably build a dynamic

Re: sql query help

2008-12-06 Thread Jason Fisher
Cool, yeah I never remember until I do it when an aggregate query is going to want HAVING vs WHERE. Glad it's working for you! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free

Re: sql query help

2008-12-06 Thread Brad Wood
- Original Message - From: Jason Fisher [EMAIL PROTECTED] Cool, yeah I never remember until I do it when an aggregate query is going to want HAVING vs WHERE. Glad it's working for you! This bites me too when I'm not paying attention. Just remember that the WHERE applies to the

Re: sql query help

2008-12-05 Thread Jason Fisher
In MS SQL Server it's ISNULL(), but can't speak for other platforms. Can't recall what it is in Oracle, might just be NULL(). ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free

Re: sql query help

2008-12-05 Thread C S
In MS SQL Server it's ISNULL(), but can't speak for other platforms. Can't recall what it is in Oracle, might just be NULL(). IIRC in Oracle it is NVL. There is also COALESCE, which is usually a safe bet with most databases.

Re: sql query help

2008-12-05 Thread Jessica Kennedy
didn't work, got an error. changed the isnull to ifnull, got a invalid use of a group function error... I don't even know how to fix that...=( Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p. short_description, p.quantity,

Re: sql query help

2008-12-05 Thread Jessica Kennedy
NM, got it... changed the where clause to having and moved it below the group by... seems to be working so far! Thanks! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial

sql query help

2008-12-04 Thread Jessica Kennedy
I have a MySQL query to pull all products from the database, no problem. I am trying to get it to only display prodcuts that are in stock, the value should be sold p.quantity in the following query. however, when sold appears as null (very often) it removes the full record, which I don't

Re: sql query help

2008-12-04 Thread Jason Fisher
Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p.short_description, p.quantity, p.image FROM tblproducts as p LEFT JOIN tblorder_list as o ON p.sku = o.sku #can_afford# WHERE SUM(ISNULL(o.qty, 0)) p.quantity GROUP BY p.sku

Re: sql query help

2008-12-04 Thread Azadi Saryev
i believe the correct function to use is IFNULL(), not ISNULL()... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Jason Fisher wrote: Try this, I think it's what you're looking for: SELECT SUM(ISNULL(o.qty, 0)) as sold, p.sku, p.name, p.points, p.short_description, p.quantity,

Re: # issue SQL Query

2008-01-27 Thread s. isaac dealey
I have a sql query (SQL Server 2000) for CFMX: SELECT @Col_with_No_Pound = @Col_with_No_Pound + CASE @Col_with_No_Pound WHEN '' THEN '' ELSE ',' END + COLUMN_NAME, @Col_with_Pound= @Col_with_Pound + CASE @Col_with_Pound WHEN '' THEN '#' ELSE '#,#' END + COLUMN_NAME

# issue SQL Query

2008-01-26 Thread Tech Gate
I have a sql query (SQL Server 2000) for CFMX: SELECT @Col_with_No_Pound = @Col_with_No_Pound + CASE @Col_with_No_Pound WHEN '' THEN '' ELSE ',' END + COLUMN_NAME, @Col_with_Pound= @Col_with_Pound + CASE @Col_with_Pound WHEN '' THEN '#' ELSE '#,#' END + COLUMN_NAME . Obviously

Re: # issue SQL Query

2008-01-26 Thread Tech Gate
demo_Col_with_No_Pound = DemoCol.Col_with_No_Pound 37 : cfset demo_Col_with_Pound = replace(#DemoCol.Col_with_Pound#, %, #, ALL) Thx much On Jan 26, 2008 11:07 AM, Tech Gate [EMAIL PROTECTED] wrote: I have a sql query (SQL Server 2000) for CFMX: SELECT @Col_with_No_Pound = @Col_with_No_Pound

RE: # issue SQL Query

2008-01-26 Thread Adrian Lynch
If ever you need the literal string # and it's in a place where ColdFusion will try to evaluate it (which is the case inside cfquery), use two ##. Adrian http://www.adrianlynch.co.uk/ -Original Message- From: Tech Gate Sent: 26 January 2008 16:29 To: CF-Talk Subject: Re: # issue SQL

Re: quot;##quot; issue amp; SQL Query

2008-01-26 Thread Don L
Very difficult to read your sql stmt. One option would be like this (aliasing column name containing # sign). e.g. Select [column a with # sign] as col1 From myTBL e.g. -- s step further with the above idea using CASE ... WHEN ... ELSE ... END as well I have a sql query (SQL Server 2000

Re: How to create a SQL query above 2 tablespaces?

2007-10-11 Thread Jochem van Dieten
Stivn .. wrote: i want to create a SQL query above 2 tablespaces. A tablespace is an implementation detail of your SQL server that does not influence the logical database stucture so you would query it the same way as you would a single tablespace. Jochem

SQL query with LIMIT option

2007-10-10 Thread Stivn ..
Hi all, i want to create a SQL query with a LIMIT option but it will produce an error. What is the correct syntax for a SQL query with LIMIT option, i tryed it like this: SELECT LABEL FROM table.name WHERE (STATUS = '1') AND (XY = 'AB') LIMIT 1,3 Thanks in advance for your help with best

Re: SQL query with LIMIT option

2007-10-10 Thread Tom Chiverton
On Wednesday 10 Oct 2007, [EMAIL PROTECTED] wrote: i want to create a SQL query with a LIMIT option but it will produce an error. What error ? On what database ? -- Tom Chiverton Helping to proactively iterate scalable markets on: http://thefalken.livejournal.com

Re: SQL query with LIMIT option

2007-10-10 Thread Jochem van Dieten
Stivn .. wrote: i want to create a SQL query with a LIMIT option but it will produce an error. What is the correct syntax for a SQL query with LIMIT option That depends on your database. With MS databases you need to use TOP, with Oracle rownum, with MySQL and PostgreSQL LIMIT. The syntax

How to create a SQL query above 2 tablespaces?

2007-10-10 Thread Stivn ..
Hi all, i want to create a SQL query above 2 tablespaces. In the query i want to compare if the value i searched fore is in tsA or tsB. I tryed it with something like this: SELECT * FROM tableA, tableB WHERE tableA.ts IN (#preserveSingleQuotes(myDocumentsA)#) OR tableB.ts

Re: How to create a SQL query above 2 tablespaces?

2007-10-10 Thread Claude Schneegans
So, i want to check if the value is in A or in B. But the result is all entrys from tableA. I don't understand. How can you select records from tableA on the only fact that a field from another table is in a list of values? -- ___ REUSE CODE! Use custom

Re: How to create a SQL query above 2 tablespaces?

2007-10-10 Thread Eric D.
Hi all, i want to create a SQL query above 2 tablespaces. In the query i want to compare if the value i searched fore is in tsA or tsB. I tryed it with something like this: SELECT * FROM tableA, tableB WHERE tableA.ts IN (#preserveSingleQuotes(myDocumentsA)#) OR tableB.ts

Get the SQL Query

2007-05-16 Thread Jerome Huff
How can I get at the actual query that is sent to the database. I can see it on the debug page, but how would I get it in a variable so I could stick it in the database or display it? Thanks ~| Create robust enterprise, web

RE: Get the SQL Query

2007-05-16 Thread Peterson, Chris
Subject: Get the SQL Query How can I get at the actual query that is sent to the database. I can see it on the debug page, but how would I get it in a variable so I could stick it in the database or display it? Thanks

RE: Get the SQL Query

2007-05-16 Thread Andy Matthews
Just FYI, that only works in CF7. -Original Message- From: Peterson, Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 16, 2007 7:21 AM To: CF-Talk Subject: RE: Get the SQL Query Set the result attribute of your query, ie: cfquery name=getData result=getDataResult Then just dump

RE: Get the SQL Query

2007-05-16 Thread Huff, Jerome P.
Thanks, That worked like a charm! Jerome -Original Message- From: Peterson, Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 16, 2007 8:21 AM To: CF-Talk Subject: RE: Get the SQL Query Set the result attribute of your query, ie: cfquery name=getData result=getDataResult

Re: Get the SQL Query

2007-05-16 Thread Christopher Jordan
. wrote: Thanks, That worked like a charm! Jerome -Original Message- From: Peterson, Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 16, 2007 8:21 AM To: CF-Talk Subject: RE: Get the SQL Query Set the result attribute of your query, ie: cfquery name=getData result

Re: Get the SQL Query

2007-05-16 Thread Barney Boisvert
Message- From: Peterson, Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 16, 2007 8:21 AM To: CF-Talk Subject: RE: Get the SQL Query Set the result attribute of your query, ie: cfquery name=getData result=getDataResult Then just dump the #getDataResult# That will give

RE: SQL Query Help

2007-04-05 Thread jennygw
thanks to everyone who replied, problem solved. Jenny -Original Message- From: Rafael Marquez [mailto:[EMAIL PROTECTED] Sent: 04 April 2007 21:06 To: CF-Talk Subject: RE: SQL Query Help Well, it's not a brain fart. That query is kinda kinky. Use this as an example, replacing your

SQL Query Help

2007-04-04 Thread jennygw
having brain fart here ... ughh scenario: customer table, invoice table I'd like to do a query to list the last invoice for each customer. Can someone point me in the right direction please? TIA, Jenny ~| ColdFusion MX7 by

RE: SQL Query Help

2007-04-04 Thread Ben Nadel
Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 8:58 AM To: CF-Talk Subject: SQL Query Help having brain fart here ... ughh scenario: customer table, invoice

RE: SQL Query Help

2007-04-04 Thread Dawson, Michael
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 7:58 AM To: CF-Talk Subject: SQL Query Help having brain fart here ... ughh scenario: customer table, invoice table I'd like to do a query to list the last invoice for each customer. Can

RE: SQL Query Help

2007-04-04 Thread Gaulin, Mark
Need more info: What would the query be to return the last invoice for a single customer? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 8:58 AM To: CF-Talk Subject: SQL Query Help having brain fart here ... ughh scenario

RE: SQL Query Help

2007-04-04 Thread Rafael Marquez
(T.Deleted = 0) AND (T.Status 'Pending') AND (T.AccountType = 'Customer') GROUP BY T.CustomerID, T.TransactionDate, T.ID Hope this helps. -Original Message- From: Gaulin, Mark [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 3:39 PM To: CF-Talk Subject: RE: SQL Query Help

sql query help

2007-02-05 Thread Mik Muller
Hey all, I'm having trouble trying to write a sql server query grouped on a datetime field. The problem is that since the time is included in the field, the date isn't really grouping well. I know of a datepart function but get an error when I try it. Any help? This sql statement groups all

Re: sql query help

2007-02-05 Thread Jim Wright
Mik Muller wrote: select left(datetime,11), count(*) as dt from sitelog where datetime = '2007-02-03 00:00' group by left(datetime,11) order by left(datetime,11) desc Well, now that I look at it, the order by is ordering by jan 1 2006 etc in

Re: sql query help

2007-02-05 Thread Mik Muller
This is how I'm doing it for now... select count(*) as dt cfif url.stats eq bar-day, left(datetime,11) as datetime/cfif from sitelog where datepart(year,datetime) = '#theyear#' and datepart(month,datetime) = '#themonth#' cfif listLen(url.datestat,/) eq 2 and datepart(year,datetime) =

How to dump a sql query to text

2007-01-22 Thread Richard Colman
I wish to store the actual text of a SQL query to a logfile. At the risk of belaboring the obvious, from: cfquery ... Select * from blah /cfquery I wish to actual put select * from blah into a text variable and write it to a logfile or data table. Can someone suggest an easy way to do

RE: How to dump a sql query to text

2007-01-22 Thread Andy Matthews
To: CF-Talk Subject: How to dump a sql query to text I wish to store the actual text of a SQL query to a logfile. At the risk of belaboring the obvious, from: cfquery ... Select * from blah /cfquery I wish to actual put select * from blah into a text variable and write it to a logfile or data table

Re: How to dump a sql query to text

2007-01-22 Thread Scott Weikert
Well, you could start by throwing the SQL query code into a var to begin with: cfset SQLVar = Select * from table Or build it up as you would build it within the cfquery tags. Then execute it: cfquery etc etc #SQLVar# /cfquery And since it's already in a var, you can write it to your DB

Re: How to dump a sql query to text

2007-01-22 Thread Christopher Jordan
cfqueryparams, then you have to get rid of those in the version that goes to the log file. If anyones got a better idea, I'd like to hear it too. :o) Cheers, Chris Richard Colman wrote: I wish to store the actual text of a SQL query to a logfile. At the risk of belaboring the obvious, from

  1   2   3   4   5   6   7   >