Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2006, 08:17 AM
Authorized User
 
Join Date: Jan 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to write sql statement for nested subuery

BC30205: End of statement expected.


dim st as string="SELECT * FROM timetable WHERE pid = '" & cv & "' and p1 in (SELECT cid from coursestaken WHERE sid = '" & var1 "')"

i am getting the above error when im running this query.whta is the correct synatx for this statement.


 
Old February 23rd, 2006, 01:39 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In what programming environment do you have this code?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 23rd, 2006, 02:25 PM
Authorized User
 
Join Date: Jan 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in asp.net im using this statement

 
Old February 23rd, 2006, 02:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In that case, I think you're missing an ampersand:

coursestaken WHERE sid = '" & var1 & "')"


HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: This Mess We're In by P.J. Harvey (Track 7 from the album: Stories From The City, Stories From The Sea) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Write Nested XML document into SQL Server tables boondocksaint20 VB.NET 0 May 2nd, 2006 12:35 PM
Nested If Statement KCTin Visual Basic 2005 Basics 3 December 28th, 2005 01:53 PM
Nested IIF Statement Help Needed Corey Access 4 November 17th, 2005 10:19 AM
Nested Fetch statement cole SQL Language 0 May 11th, 2005 06:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.