MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 5th, 2004, 09:45 AM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
SQL Brain Fart

I feel like I am having a total brain fart. I am trying to use a select * where statement to get all the records from my database that match a given setup and using a URL variable:
Code:

SELECT * FROM dbo.TerraLogMain WHERE Volume = '#URL.VolumeID#'


Now I know for a fact that there are multiple records for Volume = Maps6 (for example) but I am only getting one record returned.

It also looks like the URL variable is getting passed okay:
Code:

http://localhost/GISTerraLog/VolumeDetail.cfm?VolumeID=Maps6

I also tried using a direct statement just to see if that gave up any hints:

SELECT *
FROM dbo.TerraLogMain
WHERE Volume = 'Maps6'

but I still only get one record returned.

So any clues as to what I am missing?

Thanks for any help!

Cheers,
Melissa

Reply With Quote
  #2  
Old October 5th, 2004, 03:00 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,912 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 12 h 17 m 55 sec
Reputation Power: 1018
love the thread subject

try WHERE Volume like '%Maps6%'

this might pinpoint problems with extraneous characters such as blanks in the data
__________________
r937.com | rudy.ca

Reply With Quote
  #3  
Old October 5th, 2004, 03:07 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
That still returns only one record

Does sql even look at or consider white spaces? I can't remember.

How would I account for those when using a url variable like '#URL.VolumeID#'? That is what I actually need to pass as I have Maps1 throgh Maps10 in a list and I want the user to be able to click on each one and see the records associated with each.

Thanks for your help!!

melissa

Reply With Quote
  #4  
Old October 5th, 2004, 03:22 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,912 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 12 h 17 m 55 sec
Reputation Power: 1018
more forensic querying...

what does this produce:
Code:
select Volume
     , count(*) as rows
  from dbo.TerraLogMain
group
    by Volume 

Reply With Quote
  #5  
Old October 5th, 2004, 03:54 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Um, sorry if this is a stupid question but where would I put the code you suggested? Would it replace the code I have which uses a URL variable sent from another page?

Thanks! (insert embarrassed smiley)
melissa

Reply With Quote
  #6  
Old October 5th, 2004, 04:00 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,912 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 12 h 17 m 55 sec
Reputation Power: 1018
Query Analyzer query window

at the moment it is advisable to put away the programming interface and talk directly to the database through a query window using plain SQL so that you can pinbpojnt your data problems

Reply With Quote
  #7  
Old October 5th, 2004, 04:04 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Oh how I wish I could. Unfortunately the main SQL guy (who has the password to our SQL Server) is out of town until next week so I'm just working in Dreamweaver with ColdFusion and some very basic SQL to create this little project log I am working on.

I guess this one will just have to wait until next week.

Thanks so much for your suggestions. You might just see me back here next week!

melissa

Reply With Quote
  #8  
Old October 5th, 2004, 04:13 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
wanted to delete this post but can't figure out how

Reply With Quote
  #9  
Old October 5th, 2004, 04:28 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Well I just figured it out. And of course it really was a total brain fart . . .

I used just a regular old <cfoutput> when displaying my query items. As soon as I changed it to <cfoutput query="myqueryname"> it works!

Thanks to r937 for trying to help me puzzle it out!

melissa (insert forehead smacking smiley here)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > SQL Brain Fart


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway