Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Query question


Message #1 by "Thomas, Charles" <CThomas@D...> on Thu, 20 Feb 2003 15:00:33 -0500
The non-existent AU_ID was purposely chosen because I wanted to show that I
want to somehow execute the statement, and have it NOT return the column
names when there is no result set.  

I hope this makes sense.

-Charles Thomas

 -----Original Message-----
From: 	Mark Chivers [mailto:markchivers@s...] 
Sent:	Friday, February 21, 2003 6:34 AM
To:	sql language
Subject:	[sql_language] RE: Query question

Have you checked that the AU_ID exists as it's not in my pubs database by
default ?

MC

-----Original Message-----
From: Thomas, Charles [mailto:CThomas@D...]
Sent: 20 February 2003 20:01
To: sql language
Subject: [sql_language] Query question


Hello all.  Is there a way I can bypass returning only the column names to
my query when no records exist using the EXEC function?  For example, if I
run the following statement:

DECLARE 
@SELECT VARCHAR(50),
@WHERE VARCHAR(50)
SET @SELECT = 'SELECT * FROM AUTHORS '
SET @WHERE = 'WHERE AU_ID = "111-11-1111"'
EXEC (@SELECT + @WHERE) 

I get no returned results, but I see the column names.  I don't want to see
the column names and just want to see "The command(s) completed
successfully." in the Message section with a blank result set screen.

Can this be done?

Thanks,

-Charles Thomas









  Return to Index