Re: SQL get the next successful transaction after a failed transaction

2009-07-24 Thread Judah McAuley
Do you want the most recent transaction that occurred after the most recent failure? Or do you want a list of the most recent transactions after every failed transaction? For case number 1 above, you could do something along the lines of: SELECT TOP 1 id, approved, date FROM mytable WHERE date >

Re: SQL Help

2009-06-30 Thread Dave Watts
> C'mon, if they are users and they have access to the system, if they go > crazy, > do they really need SQL injection to harm the system ? > They can simply delete all what they have access to, they can replace > content by porn, whatever. > Will CFQURYPARAM protect your application against that

Re: SQL Help

2009-06-30 Thread Claude Schneegans
>>Also, you talk about this like your speaking of only internal applications or applications that could never go on a production environment. Indeed, we were talking about building SQL queries in a variable inside a Content management system. Of course, for parts of the site exposed to public,

RE: SQL Help

2009-06-30 Thread Justin Scott
> If you don't take security in mind when writing > applications it's just a matter of time before > something bad happens. I can't tell you how many times I've been contacted by people who have had their site broken and need an emergency fix. I've made quite a bit of money fixing other people's

RE: SQL Help

2009-06-30 Thread Paul Alkema
27;s just a matter of time before something bad happens. -Original Message- From: Claude Schneegans [mailto:schneeg...@internetique.com] Sent: Tuesday, June 30, 2009 11:19 AM To: cf-talk Subject: Re: SQL Help >>With XSS they can do that while making it look like someone else did it. Probably,

Re: SQL Help

2009-06-30 Thread Claude Schneegans
>>With XSS they can do that while making it look like someone else did it. Probably, but my clients barely know the difference between a computer and a toaster, and I spend more of my time explaining them that in order to "press Ctrl", they must find a key on their keyboard with the letters "C

Re: SQL Help

2009-06-30 Thread James Holmes
With SQL injection they can delete what they don't have access to. With XSS they can do that while making it look like someone else did it. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/6/30 Claude Schneegans : > >  >>Internal security problems are far more

Re: SQL Help

2009-06-30 Thread Claude Schneegans
>>Internal security problems are far more common than external ones. Within a large organization, not all users may be trustworthy. C'mon, if they are users and they have access to the system, if they go crazy, do they really need SQL injection to harm the system ? They can simply delete all wh

Re: SQL Help

2009-06-30 Thread James Holmes
Sure, as long as the CMS has no XSS attack points... mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/6/30 Claude Schneegans : > >  >>And with preserveSingleQuotes() you have to hope you're better at > cleaning input than hackers are at writing SQL injection.

Re: SQL Help

2009-06-30 Thread Dave Watts
> When I'm talking about a CMS, I'm talking about some tool some customers > have paid for and that is only accessible by approved users with > authentication. > Now if they want to hack and sabotage their own application they have > paid for, it's their problem, and if it ever happens, they will

RE: SQL Help

2009-06-30 Thread Paul Alkema
would just use a stored proc and feed in the name. -Original Message- From: Scott Brady [mailto:dsbr...@gmail.com] Sent: Tuesday, June 30, 2009 9:52 AM To: cf-talk Subject: Re: SQL Help There's no reason you need a variable to do multiple updates in a single query statement. You can

Re: SQL Help

2009-06-30 Thread Scott Brady
There's no reason you need a variable to do multiple updates in a single query statement. You can still put the SQL inside the query tags and, as you say, separate the statements with a semi-colon. Scott On Tue, Jun 30, 2009 at 6:55 AM, Stephane Vantroyen wrote: > > I don't agree with that : som

Re: SQL Help

2009-06-30 Thread Claude Schneegans
>>And with preserveSingleQuotes() you have to hope you're better at cleaning input than hackers are at writing SQL injection. When I'm talking about a CMS, I'm talking about some tool some customers have paid for and that is only accessible by approved users with authentication. Now if they wan

RE: SQL Help

2009-06-30 Thread Paul Alkema
phane Vantroyen [mailto:s...@emakina.com] Sent: Tuesday, June 30, 2009 8:55 AM To: cf-talk Subject: Re: SQL Help "it's not good practice in ColdFusion to do this. " I don't agree with that : sometimes you have to do multiple updates, inserts or else at the same time, depending

Re: SQL Help

2009-06-30 Thread James Holmes
And with preserveSingleQuotes() you have to hope you're better at cleaning input than hackers are at writing SQL injection. And yes, we all know you're totally awesome at it; this response is for others who'd rather not make that bet. mxAjax / CFAjax docs and other useful articles: http://www.bif

Re: SQL Help

2009-06-30 Thread Claude Schneegans
>>As Dominic said, putting the entire sql statement in as a variable in ColdFusion isn't necessary. Please, there IS a very good reason one would put an SQL statement in a variable: when using some tool to generate build queries for instance. I have many examples in my own CMS, like a report bu

Re: SQL Help

2009-06-30 Thread Stephane Vantroyen
"it's not good practice in ColdFusion to do this. " I don't agree with that : sometimes you have to do multiple updates, inserts or else at the same time, depending on your process and some conditions; instead of doing multiple (and thus multiple db connections), it is sometimes cool to be a

RE: SQL Help

2009-06-30 Thread Paul Alkema
#replace(sqlToRun,"''","'","ALL")# Paul Alkema -Original Message- From: Dominic Watson [mailto:watson.domi...@googlemail.com] Sent: Tuesday, June 30, 2009 5:22 AM To: cf-talk Subject: Re: SQL Help Basically, the is kind of redundant a

Re: SQL Help

2009-06-30 Thread Dominic Watson
Basically, the is kind of redundant and negates the benefit of the cfquery tag. Put all you SQL inside the cfquery tag. cfqueryparam is only valid within cfquery tags. Dominic 2009/6/28 Jason Slack : > > CF 8.01 OS X. > > I have: > > > >         #sqlToRun# > >         >           #sqlToRun# >

Re: SQL Help

2009-06-28 Thread Matt Quackenbush
A) Always use . (Note the period.) B) When in doubt, use anyways. (Note the period.) C) While preserveSingleQuotes() can be a useful tool at times, I would have a very difficult time thinking of a time where I would use it. D) Always use . (Note again, the period.) E) You cannot use in the mi

Re: SQL Help

2009-06-28 Thread Jason Slack
Right I am switching everything to as I read about SQL injection. Do you see my Invalid CFML construct found on line 22 at column 120. above though? I still dont. -Jason >if you're going to be generating your SQL like that, you'll need to wrap >your final variable in preserveSingleQuotes().

Re: SQL Help

2009-06-28 Thread Charlie Griefer
if you're going to be generating your SQL like that, you'll need to wrap your final variable in preserveSingleQuotes(). so... #preserveSingleQuotes(sqlToRun)# it will be pointed out to you (possibly before I even finish composing this response), that you are leaving yourself open to SQL

RE: SQL Injection

2009-04-24 Thread Justin Scott
> If I am using an Application.cfc, would there be any > benefit of putting the structure into the application > scope, then never deleting it? It certainly couldn't hurt. I chose to do it the way I did because I wanted it to be completely self-contained and drop-in friendly regardless of the se

RE: SQL Injection

2009-04-24 Thread William Seiter
April 24, 2009 10:59 AM To: cf-talk Subject: RE: SQL Injection > We have one site on our server that was built about > 10 years ago. Today some bot is hitting the site and > appending their content to the content already in the > system. I can't figure out how or where they are >

RE: SQL Injection

2009-04-24 Thread Mark Kruger
Didn't Homer Simpson say "rinse and repeat Always repeat" :) -Original Message- From: Justin Scott [mailto:jscott-li...@gravityfree.com] Sent: Friday, April 24, 2009 12:59 PM To: cf-talk Subject: RE: SQL Injection > We have one site on our server that was bu

RE: SQL Injection

2009-04-24 Thread Justin Scott
> We have one site on our server that was built about > 10 years ago. Today some bot is hitting the site and > appending their content to the content already in the > system. I can't figure out how or where they are > getting in. Anyone have any ideas how I can stop this. If you're sure it's SQL

RE: SQL Injection

2009-04-24 Thread Mark Kruger
Start here http://www.coldfusionmuse.com/index.cfm/2008/7/18/Injection-Using-CAST-And-A SCII -Mark Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Chad McCue [mailto:c...@advmediaproductions.com] S

Re: SQL server - Order totals by month, even without month data

2009-03-26 Thread Will Tomlinson
Thanks to everyone for their help with this! Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://ww

RE: SQL server - Order totals by month, even without month data

2009-03-25 Thread brad
Original Message Subject: Re: SQL server - Order totals by month, even without month data From: Greg Morphis Date: Wed, March 25, 2009 7:26 am To: cf-talk Create a dummy table with the information for the current year and preform a UNION to your existing data On Wed, Mar 25, 2009 at 6:26

Re: SQL server - Order totals by month, even without month data

2009-03-25 Thread Greg Morphis
Create a dummy table with the information for the current year and preform a UNION to your existing data On Wed, Mar 25, 2009 at 6:26 AM, Will Tomlinson wrote: > > I have your typical tblorders. I'm trying to query it to get order totals by > month, and I'm outputting them in > > All goes fine

Re: SQL server - Order totals by month, even without month data

2009-03-25 Thread Azadi Saryev
when i had to do a similar thing, this is how i did it: your query returns monthName and totalOrders columns. create a structure from your query with Month as key and Total as value: create a list of month names in the format returned by your query: create a new query you will use for you

Re: SQL server - Order totals by month, even without month data

2009-03-25 Thread Azadi Saryev
posted a reply hours ago, but it still hasn't showed up... reposting... when i had to do a similar thing, this is how i did it: your query returns monthName and totalOrders columns. create a structure from your query with Month as key and Total as value: create a list of month names in the

RE: SQL server - Order totals by month, even without month data

2009-03-25 Thread William Seiter
There are 2 ways that come to mind right off the bat. 1. Create another table that has each month in it. Do an outer join that allows the other table to return 0 for the months where you have no records in your original table 2. Inspect the query in CF for missing months. If there are any miss

Re: SQL server - Order totals by month, even without month data

2009-03-25 Thread Donnie Carvajal
The only way to get data into a query is to have data in a table. So there are a couple of options. 1. Create a months table that has 12 records 2. Create a temp table with 12 records You may also need to create a years table as well. Then your query would be something like SELECT year, mo

RE: SQL server - Order totals by month, even without month data

2009-03-25 Thread Robert Rawlins
Hello Will, I'd advise building yourself a calendar table, these are always a useful facility in any application where you're going to be doing report generation, I've attached the SQL script which creates and populates your calendar table, this basically creates a record for each date in a range

RE: SQL server - Order totals by month, even without month data

2009-03-25 Thread Dawson, Michael
Create a calendar table. Load it with dates from 1900-2100. Each record relates to a single day. You can join to this table in many ways. Here is an example of one of my records... date 1900-01-01 00:00:00.000 dayOfWeek 2 dayOfWeekName Monday day 1 dayLeadingZero 01 month 1 monthLeading

RE: SQL server - Order totals by month, even without month data

2009-03-25 Thread Dawson, Michael
Also, since you are using SQL, you can use a CTE to dynamically generate a date range as a temp table, so to speak. I prefer a regular table as I mentioned in my last reply, however. Thanks, Mike -Original Message- From: Will Tomlinson [mailto:w...@wtomlinson.com] Sent: Wednesday, Marc

Re: SQL Syntax error

2009-03-16 Thread Steve Lichtenberg
worked for me. Plus, that is what Adobe shows in their docs. 2009/3/16 Jason Fisher : > > Interesting ... COUNT(DISTINCT prodcode) will work, huh? That may come in > handy some day. Thanks! > > > > ~| Adobe® ColdFusion® 8 so

Re: SQL Syntax error

2009-03-16 Thread Donnie Carvajal
COUNT(DISTINCT [fieldName] is very important to remember when using JOINS. For example, if you have the query... SELECT COUNT(A.code) AS total FROM TableA A INNER JOIN TableB ON A.code = B.code And you wanted to know how many records in TableA have records in TableB. If this query returns 10

Re: SQL Syntax error

2009-03-16 Thread Jason Fisher
Interesting ... COUNT(DISTINCT prodcode) will work, huh? That may come in handy some day. Thanks! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doublecli

Re: SQL Syntax error

2009-03-16 Thread Steve Lichtenberg
Thanks. I found it finally. The right syntax (for this issue) is select count(distinct prodcode) as prodcnt There was a second issue with computed_field_1 the was being bounced by the ODBC driver as well. On Mon, Mar 16, 2009 at 3:54 PM, Jason Fisher wrote: > > This is invalid: > > distinct(

re: SQL Syntax error

2009-03-16 Thread Jason Fisher
This is invalid: distinct(count prodcode) Are you trying to do a DISTINCT on the aggregate function COUNT()? Not sure that would work, but it would have to be DISTINCT COUNT(prodcode) if that's what you're after. ~| Adobe

Re: SQL Syntax error

2009-03-16 Thread Steve Lichtenberg
I forgot the code snippet. select distinct(count prodcode) from product where product.manufid = '#scan.manufid#' AND product.famcode2 matches '#left(scan.famcode, 2)#.' ANDproduct.famcode2 matches '#left(scan.famcode,1)#..' AND

RE: SQL Queries to Linked Server SQL 2005 / Access 2007

2009-03-12 Thread William Seiter
Hey Jeanmarie, I have always used OpenQuery() for my linked server connections. SELECT * FROM openquery([connectionname], '[query]') The cool thing about this is that you can bring everything from the access dB to the SQL server for joining. Example might be... SELECT * FROM

Re: SQL Server 2005 Datasource failing

2009-02-18 Thread Stan Winchester
For those who are interested this was solved at: http://forums.newatlanta.com/messages.cfm?threadid=D0F5E9DE-C84B-43EC-8C34667F8FB9077B Thanks to those who helped! Stan ~| Adobe® ColdFusion® 8 software 8 is the most important

Re: SQL Server 2005 Datasource failing

2009-02-18 Thread Stan Winchester
I checked that TCP/IP is enabled and it was. I found an article that talked about making sure SQL Server 2000 was at least sp3a, so I updated to sp4. Now CF8 on a remote box verifies the connection, but BD7 does not (BD7 is on the same box as CF8). I get the error: "Login failed for user '[us

Re: SQL question

2009-02-17 Thread Mike Soultanian
Mike Kear wrote: > The first two examples are selecting the literal value 'mike' and '1' > In the first example, you are telling SQL to give the column > containing 'mike' a name of 'name'. aha.. literal was the word I was looking for. I did a search for "sql select literal" and it led me to

RE: SQL Server 2005 Datasource failing

2009-02-17 Thread Pat Wenke
Is TCP/IP enabled on your SQL 2005 instance? By default, TCP/IP connections are disabled in SQL 2005. - Pat -Original Message- From: Brad Wood [mailto:b...@bradwood.com] Sent: Tuesday, February 17, 2009 10:32 PM To: cf-talk Subject: Re: SQL Server 2005 Datasource failing What port

Re: SQL Server 2005 Datasource failing

2009-02-17 Thread Brad Wood
What port is SQL Server 2005 listening on? Also, can you connect using the same password in Enterprise Manager? Run a trace on the 2005 database and include failed login events from the audit group. Can you see the login failures coming through. If not, CF isn't hitting the correct SQL instan

Re: SQL question

2009-02-16 Thread Brian Kotek
I've always known it as selecting a literal value. So "SELECT 1" is "select the literal value 1". On Mon, Feb 16, 2009 at 7:41 PM, Mike Soultanian wrote: > > I was curious if anyone knows how you describe the following SQL > functionality: > > SELECT 'mike' as name > > returns a single column n

Re: SQL question

2009-02-16 Thread Dave Watts
> I was curious if anyone knows how you describe the following SQL > functionality: > > ... > > The last one is obvious as it's SQL arithmetic, but what are the first > two examples? Are those also examples of "SQL arithmetic" as well? I > can't find this kind of SQL functionality described or d

Re: SQL question

2009-02-16 Thread Mike Kear
The first two examples are selecting the literal value 'mike' and '1' In the first example, you are telling SQL to give the column containing 'mike' a name of 'name'. A practical example of where you might use this behaviour might be : SELECT 'Invoice' as doctype, invoiceno, invoicedate, am

Re: SQL Replication Models

2009-02-16 Thread Don L
>> Those do not appear to be very challenging requirements. You could >> probably even do this without any of the built-in replication at all >> but with just incremental backups. How have you currently configured >> your backups? Do you notice a performance impact when you run a full >> backup? D

Re: SQL Replication Models

2009-02-16 Thread Jochem van Dieten
On Mon, Feb 16, 2009 at 1:10 PM, C. Hatton Humphrey wrote: > Jochem van Dieten wrote: > The current schedule for backups is a full backup at 3am for the group > of databases and then a transactional backup every hour from 7am to > 10pm during the week. >> For performance size doesn't matter all

Re: SQL Replication Models

2009-02-16 Thread C. Hatton Humphrey
> Those do not appear to be very challenging requirements. You could > probably even do this without any of the built-in replication at all > but with just incremental backups. How have you currently configured > your backups? Do you notice a performance impact when you run a full > backup? Do you

Re: SQL Replication Models

2009-02-16 Thread C. Hatton Humphrey
> Don wrote: > With regard to 1,498 tables, do you mean, User Tables? just for clarity. Yes, 1498 user tables. The application was originally built on a flat-file database system like DB3/4 or Foxpro and was ported to SQL Server without re-engineering the database. All of the tables have 8 char

Re: SQL Replication Models

2009-02-16 Thread Jochem van Dieten
On Mon, Feb 16, 2009 at 1:16 AM, C. Hatton Humphrey wrote: > The main thing I'm worried about is any performance "hit" on the > publishing server. The target server can lag behind data-wise by a > bit (30 minutes to an hour is an acceptable delay). Those do not appear to be very challenging requ

Re: SQL Replication Models

2009-02-15 Thread Don L
>Thanks for the comments, Don! > >The main thing I'm worried about is any performance "hit" on the >publishing server. The target server can lag behind data-wise by a >bit (30 minutes to an hour is an acceptable delay). The problem is >the size. A MS Dynamics GP database contains 1,498 tables (

Re: SQL Replication Models

2009-02-15 Thread C. Hatton Humphrey
Thanks for the comments, Don! The main thing I'm worried about is any performance "hit" on the publishing server. The target server can lag behind data-wise by a bit (30 minutes to an hour is an acceptable delay). The problem is the size. A MS Dynamics GP database contains 1,498 tables (not in

Re: SQL Replication Models

2009-02-15 Thread Don L
>Question for anyone that handles SQL Replication: What effect would >setting up transactional replication from a large Windows 2000 >database (17 Gb) with moderate usage (18-20 max simultaneous >connections) to a Windows 2005 server have on the performance of the >Windows 2000 machine? > >The rea

Re: SQL query sorting problem

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

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 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. Aza

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 orde

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 MSSQL:

Re: SQL query sorting problem

2009-01-25 Thread Azadi Saryev
rty a UNION query generated inside a : (SELECT *, #j# AS sortcol FROM cities WHERE state = '#listgetat(states, j)#') UNION ORDER BY sortcol, city you could also probably build a dynamic CASE statement instead of using a UNION query, but i will need to check up the syntax of that... Azadi Sa

Re: SQL CASE STATEMENTS

2009-01-19 Thread Barney Boisvert
CASE is part of core SQL, not an MS extension in T-SQL. But not supported by QofQ either way. Write to your local Adobe rep today!! cheers, barneyb On 1/19/09, Andy Matthews wrote: > I don't believe you can use T-SQL case statements in a QofQ. > > -Original Message- > From: Torrent Gir

RE: SQL CASE STATEMENTS

2009-01-19 Thread Andy Matthews
I don't believe you can use T-SQL case statements in a QofQ. -Original Message- From: Torrent Girl [mailto:torrentg...@gmail.com] Sent: Monday, January 19, 2009 8:19 AM To: cf-talk Subject: SQL CASE STATEMENTS Can I use case statements within a QoQ? ~

Re: SQL CASE STATEMENTS

2009-01-19 Thread Brian Kotek
If you mean SQL case statements, no. On Mon, Jan 19, 2009 at 9:19 AM, Torrent Girl wrote: > Can I use case statements within a QoQ? > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get

Re: SQL CASE STATEMENTS

2009-01-19 Thread John M Bliss
If you're referring to something like the following, then sure: select stuff from stuff where things = 2 things = 1 On Mon, Jan 19, 2009 at 8:19 AM, Torrent Girl wrote: > Can I use case statements within a QoQ? > > ~|

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-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-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 h

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.quant

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 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 T

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, p.

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 between dates problem

2008-12-02 Thread Dawson, Michael
"datetime" would be your variable or another column to which you would compare the coupon start/end dates. Mike -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2008 7:00 PM To: cf-talk Subject: Re: SQL between dates problem &

Re: SQL between dates problem

2008-12-02 Thread Will Tomlinson
Screw it. I'm just telling my client to enter the day after as the expiration date of the coupon. It works. But one thing I noticed and tested is, you can insert a date like so into SQL server and it accepts it and converts it to the right format. 12/01/2008 10:37 PM So I could have two inpu

Re: SQL between dates problem

2008-12-01 Thread Will Tomlinson
>If you are using MS SQL... > >SELECT CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) > >This will remove any time part from a datetime field. I'm getting an error from the SQL. I've played around with it with no luck. SELECT couponpercdisc, CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) F

Re: SQL between dates problem

2008-12-01 Thread Will Tomlinson
>I would do something like: > >WHERE datetime BETWEEN CAST(FLOOR(CAST(couponstartdate AS float)) AS >datetime) >AND CAST(FLOOR(CAST(couponenddate AS float)) AS datetime) > I'm remote right now, but will give it a whirl tonight. Thanks for your help! Will ~~

RE: SQL between dates problem

2008-12-01 Thread Dawson, Michael
tatement. Mike -Original Message- From: John M Bliss [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2008 9:23 AM To: cf-talk Subject: Re: SQL between dates problem Another CFMLish option: couponstartdate <= #CreateODBCDateTime(CreateDateTime(DatePart("", Now()), DateP

Re: SQL between dates problem

2008-12-01 Thread John M Bliss
(CAST(couponenddate AS float)) AS datetime) > > -Original Message- > From: Will Tomlinson [mailto:[EMAIL PROTECTED] > Sent: Monday, December 01, 2008 9:05 AM > To: cf-talk > Subject: Re: SQL between dates problem > > >If you are using MS SQL... > > > >SELECT

RE: SQL between dates problem

2008-12-01 Thread Dawson, Michael
Subject: Re: SQL between dates problem >If you are using MS SQL... > >SELECT CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) > >This will remove any time part from a datetime field. > So then I write it like this? AND datetime >= couponstartdate and datetime <= coupo

Re: SQL between dates problem

2008-12-01 Thread Will Tomlinson
>If you are using MS SQL... > >SELECT CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) > >This will remove any time part from a datetime field. > So then I write it like this? AND datetime >= couponstartdate and datetime <= couponenddate Thanks! Will

Re: SQL between dates problem

2008-12-01 Thread Will Tomlinson
>Try this: > >AND GETDATE() >= '#couponstartdate# 00:00:00' and GETDATE() <= >'#couponenddate# 23:59:59' > Except the values I want to match them against are the value in a column - not a couponstartdate or couponenddate variable. Thanks! Will ~

RE: SQL between dates problem

2008-12-01 Thread Dawson, Michael
If you are using MS SQL... SELECT CAST(FLOOR(CAST(GETDATE() AS float)) AS datetime) This will remove any time part from a datetime field. Mike -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2008 8:32 AM To: cf-talk Subject: Re: SQL between

RE: SQL between dates problem

2008-12-01 Thread Duane Boudreau
Try this: AND GETDATE() >= '#couponstartdate# 00:00:00' and GETDATE() <= '#couponenddate# 23:59:59' -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Monday, December 01, 2008 10:17 AM To: cf-talk Subject: SQL between dates problem SQL server 2000. I have two col

Re: SQL between dates problem

2008-12-01 Thread Will Tomlinson
>Because GETDATE() will return the current date *and time* and I'll bet >that your start/end dates are coming back as 12/1/2008 12:00 AM. > Ahhh yes! That makes sense. Thanks John! Will ~| Adobe® ColdFusion® 8 software 8 is

Re: SQL between dates problem

2008-12-01 Thread John M Bliss
Because GETDATE() will return the current date *and time* and I'll bet that your start/end dates are coming back as 12/1/2008 12:00 AM. On 12/1/08, Will Tomlinson <[EMAIL PROTECTED]> wrote: > SQL server 2000. > > I have two columns - startdate and enddate, why would this not return a > record if t

Re: sql param error

2008-11-22 Thread Seb Duggan
One thing to bear in mind with errors thrown in the middle of a query is that the specified line number is not necessarily the problem one - it just means there's an error somewhere in the query. In this case, somewhere in the query there's an integer parameter that you're trying to insert i

Re: sql param error

2008-11-21 Thread Dominic Watson
My best guess would be that the db column is an nText, either by mistake or perverse design... Dominic 2008/11/21 Dawson, Michael <[EMAIL PROTECTED]>: > Wrap the value in val(). > > Mike > > -Original Message- > From: Scott Stewart [mailto:[EMAIL PROTECTED] > Sent: Friday, November 21, 20

RE: sql param error

2008-11-21 Thread Dawson, Michael
Wrap the value in val(). Mike -Original Message- From: Scott Stewart [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2008 11:11 AM To: cf-talk Subject: sql param error 489 : Corrective_Explain = 490 : *491 : where Info_Id = *

Re: SQL: Outer Join question.

2008-11-04 Thread Ian Skinner
Jason Fisher wrote: > Give this a try. It will still honor the LEFT OUTER JOIN while using both of > your tests to select 'b' records. Thank you, that worked perfectly. Ian ~| Adobe® ColdFusion® 8 software 8 is the most impor

Re: SQL: Outer Join question.

2008-11-04 Thread Jason Fisher
Give this a try. It will still honor the LEFT OUTER JOIN while using both of your tests to select 'b' records. >SELECT > a.field, > count(b.field) > >FROM > aTable a LEFT OUTER JOIN bTable b > ON a.key = b.fkey > AND b.year BETWEEN 2000 AND 2003 > AND b.type = 'C' > >GROUP B

Re: SQL help..

2008-10-29 Thread cf coder
I'm really greatful to you for the post. >Just answered this on the SQL list: >http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:855 ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date

Re: SQL help..

2008-10-29 Thread Peter Boughton
Just answered this on the SQL list: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:855 ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick

Re: SQL Server on development box?

2008-10-08 Thread Gerald Guido
Thanx Jim. Awesome resource!! ~G~ On Wed, Oct 8, 2008 at 7:19 PM, Jim Davis <[EMAIL PROTECTED]>wrote: > > -Original Message- > > From: Gerald Guido [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 08, 2008 6:19 PM > > To: cf-talk > > Subjec

RE: SQL Server on development box?

2008-10-08 Thread Jim Davis
> -Original Message- > From: Gerald Guido [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 08, 2008 6:19 PM > To: cf-talk > Subject: Re: SQL Server on development box? > > >> absolute best-of-breed management tools > > The only issue I really had

<    1   2   3   4   5   6   7   8   9   10   >