• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

NULL value

Guest
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

how can write this syntext. I want to check the null value from db. I am using sqlserver. I have to put double quotes or single coutes. thanks

<cfquery name="ss" datasource="ddd">
select type from xdd
</cfquery>

<cfif #rp.type# eq "" or #rp.type# eq NULL>
<cfset type='dd'>
</cfif>

Views

380

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

Is this what you are asking?

SELECT yourfield
FROM yourtable
WHERE somefield IS NULL

EDIT: Sorry, disregard my reply as I misread your original post.

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

<cfif Len(Trim(ss.type)) eq 0>
<cfset type='dd'>
</cfif>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

I want to check if value is null from my query

for example like this NULL or " " in my if statement

cfif #rp.type# eq "" or #rp.type# eq NULL>
<cfset type='dd'>
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

LATEST
If you insist, assuming the unlikely event your query returns the null string, do

<cfif Len(Trim(ss.type)) eq 0 OR ss.type is "null">
<cfset type='dd'>
</cfif>

(Incidentally, the name of your query is ss not rp)


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation