Print Page | Close Window

Question About SQL String

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12978
Printed Date: 30 March 2026 at 5:41am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Question About SQL String
Posted By: Misty
Subject: Question About SQL String
Date Posted: 14 December 2004 at 2:05am
I would like to set a sql string to something like:
 
sqlString = sqlString & " where StaffID=" & StaffID
sqlString = sqlString & " and bio <> ""
 
I would like for the SQL String to only display records with a certain staffID and where the bio field is not blank. The bolded sql string above didn't work. I am not sure how to accomplish this. Can someone please help me with this?



Replies:
Posted By: Mart
Date Posted: 14 December 2004 at 2:11am
try AND NOT bio = NULL


Posted By: Misty
Date Posted: 14 December 2004 at 2:23am
Unfortunately, it didn't work. I got the following error message: 
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

sqlString = sqlString & " AND NOT bio = NULL
--------------------------------------------^



Posted By: Gullanian
Date Posted: 14 December 2004 at 5:11am
Put another " at the end:

sqlString = sqlString & " AND NOT bio = NULL"


Posted By: Misty
Date Posted: 14 December 2004 at 1:46pm
I tried sqlString = sqlString & " AND NOT Bio = NULL". I didn't get an error message. But it didn't work. It would not show me records where the bio field was not null. I am not sure what is wrong. Can someone please help me with this?


Posted By: Gullanian
Date Posted: 14 December 2004 at 1:51pm
SELECT * FROM tableName WHERE bio <> "" AND bio <> null

If you are not getting the expected results it pays to put them straight into the database query manager and testing results.


Posted By: Misty
Date Posted: 14 December 2004 at 2:01pm
I finally got it to work by using the following sql strings:
 
     sqlString = "select * from Staff"     
     sqlString = sqlString & " where StaffID=" & StaffID
     sqlString = sqlString & " and bio <> null



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net