RE: Insert best practice

2006-09-27 Thread Ben Nadel
Victor, I don't think it matters so much. I personally like the second solution better as it is just more readable and I think it will give you more flexibility if you need it (structural flexibility, not logical flexibility). On a personal note, what I would do is param the value to an

RE: Insert best practice

2006-09-27 Thread Snake
Cfqueryparam allows to to specify that NULL values are allowed anyway, so you don't need to do that check. Russ -Original Message- From: Victor Moore [mailto:[EMAIL PROTECTED] Sent: 27 September 2006 16:51 To: CF-Talk Subject: Insert best practice Hi, I was wondering which one are

RE: Insert best practice

2006-09-27 Thread Dawson, Michael
You might try using YesNoFormat() rather than IIF(). Just remember to NOT the result if the expression calls for it. null=NOT yesNoFormat(expression)... M!ke -Original Message- From: Victor Moore [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 10:51 AM To: CF-Talk

RE: Insert best practice

2006-09-27 Thread COLLIE David
I was wondering which one are best practices when doing a db insert/update: cfqueryparam value=#lfield# cfsqltype=CF_SQL_INTEGER null=#iif((filed eq ), de(yes), de(no))# /, or cfif val (field) gt 0) cfqueryparam value=#lfield# cfsqltype=CF_SQL_INTEGER / cfelse null

Re: Insert best practice

2006-09-27 Thread Victor Moore
Thanks all. I think I will stick with the second one. Maybe more typing but it's cleaner. Cheers Victor ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your

RE: Insert best practice

2006-09-27 Thread DURETTE, STEVEN J \(ASI-AIT\)
and it put null in the database, not my value. Steve. -Original Message- From: COLLIE David [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 12:03 PM To: CF-Talk Subject: RE: Insert best practice I was wondering which one are best practices when doing a db insert

RE: Insert best practice

2006-09-27 Thread COLLIE David
Cfqueryparam allows to to specify that NULL values are allowed anyway, so you don't need to do that check. Can you explain what you mean? ColdFusion has no concept of null. The NULL attribute, if set to 'YES' means that CFQUERYPARAM ignores the value in the VALUE attribute and passed the

Re: Insert best practice

2006-09-27 Thread Teddy Payne
If you are using MS SQL Server, create a stored proc and let the null handlers like isNull() and nullIF() handle these for you. A friend of mine showed me this little trick: select column from table where IsNull(ID,'') = IsNull(NullIf(@ID,''),IsNull(ID,'')) This allows you to create

RE: Insert best practice

2006-09-27 Thread Snake
:[EMAIL PROTECTED] Sent: 27 September 2006 17:22 To: CF-Talk Subject: RE: Insert best practice Cfqueryparam allows to to specify that NULL values are allowed anyway, so you don't need to do that check. Can you explain what you mean? ColdFusion has no concept of null. The NULL attribute, if set

Re: Insert best practice

2006-09-27 Thread Matt Robertson
I have always used cfqueryparam cfsqltype=CF_SQL_VARCHAR value=#form.fieldname# null=#YesNoFormat(not Len(form.fieldname))# You guys are saying the null parameter is not necessary? Wouldn't that insert an empty string rather than a null? -- [EMAIL PROTECTED] Janitor,